From eebfe2be086b0aea6f143cdd9e9efae9132f5e05 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Mon, 8 Oct 2018 22:44:30 -0400 Subject: [PATCH] get_address fix --- torba/basedatabase.py | 6 +++--- torba/baseledger.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/torba/basedatabase.py b/torba/basedatabase.py index dc360af47..ae2f48ce8 100644 --- a/torba/basedatabase.py +++ b/torba/basedatabase.py @@ -327,7 +327,7 @@ class BaseDatabase(SQLiteMixin): for row in tx_rows: txids.append(row[0]) txs.append(self.ledger.transaction_class( - raw=row[1], height=row[2], position=row[3], is_verified=row[4] + raw=row[1], height=row[2], position=row[3], is_verified=bool(row[4]) )) annotated_txos = { @@ -444,10 +444,10 @@ class BaseDatabase(SQLiteMixin): return count[0][0] @defer.inlineCallbacks - def get_address(self, address): + def get_address(self, **constraints): addresses = yield self.get_addresses( cols=('address', 'account', 'chain', 'position', 'pubkey', 'history', 'used_times'), - address=address, limit=1 + limit=1, **constraints ) if addresses: return addresses[0] diff --git a/torba/baseledger.py b/torba/baseledger.py index 8eb888264..d5e2af3e4 100644 --- a/torba/baseledger.py +++ b/torba/baseledger.py @@ -177,14 +177,14 @@ class BaseLedger(metaclass=LedgerRegistry): @defer.inlineCallbacks def get_local_status(self, address): - address_details = yield self.db.get_address(address) + address_details = yield self.db.get_address(address=address) history = address_details['history'] or '' h = sha256(history.encode()) return hexlify(h) @defer.inlineCallbacks def get_local_history(self, address): - address_details = yield self.db.get_address(address) + address_details = yield self.db.get_address(address=address) history = address_details['history'] or '' parts = history.split(':')[:-1] return list(zip(parts[0::2], map(int, parts[1::2])))