get_address fix

This commit is contained in:
Lex Berezhny 2018-10-08 22:44:30 -04:00
parent 3a264c1eec
commit eebfe2be08
2 changed files with 5 additions and 5 deletions

View file

@ -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]

View file

@ -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])))