include tx in db get_txos()

This commit is contained in:
Lex Berezhny 2019-03-22 03:03:48 -04:00
parent cfa74985e0
commit 9589ac6d02

View file

@ -444,19 +444,16 @@ class BaseDatabase(SQLiteMixin):
if 'order_by' not in constraints: if 'order_by' not in constraints:
constraints['order_by'] = ["tx.height=0 DESC", "tx.height DESC", "tx.position DESC"] constraints['order_by'] = ["tx.height=0 DESC", "tx.height DESC", "tx.position DESC"]
rows = await self.select_txos( rows = await self.select_txos(
"amount, script, txid, tx.height, txo.position, chain, account", **constraints "raw, txo.position, chain, account", **constraints
) )
output_class = self.ledger.transaction_class.output_class txos = []
return [ for row in rows:
output_class( tx = self.ledger.transaction_class(row[0])
amount=row[0], txo = tx.outputs[row[1]]
script=output_class.script_class(row[1]), txo.is_change = row[2] == 1
tx_ref=TXRefImmutable.from_id(row[2], row[3]), txo.is_my_account = row[3] == my_account
position=row[4], txos.append(txo)
is_change=row[5] == 1, return txos
is_my_account=row[6] == my_account
) for row in rows
]
async def get_txo_count(self, **constraints): async def get_txo_count(self, **constraints):
constraints.pop('offset', None) constraints.pop('offset', None)