increment scema version and force specific indexes to be used for get_txos()

This commit is contained in:
Lex Berezhny 2020-03-21 15:08:14 -04:00
parent 7cb530c334
commit 5cd7e9a9b8
2 changed files with 6 additions and 4 deletions

View file

@ -387,7 +387,7 @@ def dict_row_factory(cursor, row):
class Database(SQLiteMixin): class Database(SQLiteMixin):
SCHEMA_VERSION = "1.1" SCHEMA_VERSION = "1.2"
PRAGMAS = """ PRAGMAS = """
pragma journal_mode=WAL; pragma journal_mode=WAL;
@ -633,7 +633,7 @@ class Database(SQLiteMixin):
txo.id: txo for txo in txo.id: txo for txo in
(await self.get_txos( (await self.get_txos(
wallet=wallet, wallet=wallet,
txid__in=txids[offset:offset+step], txid__in=txids[offset:offset+step], order_by='txo.txid',
include_is_spent=include_is_spent, include_is_spent=include_is_spent,
include_is_my_input=include_is_my_input, include_is_my_input=include_is_my_input,
include_is_my_output=include_is_my_output, include_is_my_output=include_is_my_output,
@ -646,7 +646,7 @@ class Database(SQLiteMixin):
txo.id: txo for txo in txo.id: txo for txo in
(await self.get_txos( (await self.get_txos(
wallet=wallet, wallet=wallet,
txoid__in=txi_txoids[offset:offset+step], txoid__in=txi_txoids[offset:offset+step], order_by='txo.txoid',
include_is_my_output=include_is_my_output, include_is_my_output=include_is_my_output,
)) ))
}) })

View file

@ -524,7 +524,9 @@ class Ledger(metaclass=LedgerRegistry):
check_db_for_txos.append(txi.txo_ref.id) check_db_for_txos.append(txi.txo_ref.id)
referenced_txos = {} if not check_db_for_txos else { referenced_txos = {} if not check_db_for_txos else {
txo.id: txo for txo in await self.db.get_txos(txoid__in=check_db_for_txos, no_tx=True) txo.id: txo for txo in await self.db.get_txos(
txoid__in=check_db_for_txos, order_by='txo.txoid', no_tx=True
)
} }
for txi in tx.inputs: for txi in tx.inputs: