forked from LBRYCommunity/lbry-sdk
get_address fix
This commit is contained in:
parent
3a264c1eec
commit
eebfe2be08
2 changed files with 5 additions and 5 deletions
|
@ -327,7 +327,7 @@ class BaseDatabase(SQLiteMixin):
|
||||||
for row in tx_rows:
|
for row in tx_rows:
|
||||||
txids.append(row[0])
|
txids.append(row[0])
|
||||||
txs.append(self.ledger.transaction_class(
|
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 = {
|
annotated_txos = {
|
||||||
|
@ -444,10 +444,10 @@ class BaseDatabase(SQLiteMixin):
|
||||||
return count[0][0]
|
return count[0][0]
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_address(self, address):
|
def get_address(self, **constraints):
|
||||||
addresses = yield self.get_addresses(
|
addresses = yield self.get_addresses(
|
||||||
cols=('address', 'account', 'chain', 'position', 'pubkey', 'history', 'used_times'),
|
cols=('address', 'account', 'chain', 'position', 'pubkey', 'history', 'used_times'),
|
||||||
address=address, limit=1
|
limit=1, **constraints
|
||||||
)
|
)
|
||||||
if addresses:
|
if addresses:
|
||||||
return addresses[0]
|
return addresses[0]
|
||||||
|
|
|
@ -177,14 +177,14 @@ class BaseLedger(metaclass=LedgerRegistry):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_local_status(self, address):
|
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 ''
|
history = address_details['history'] or ''
|
||||||
h = sha256(history.encode())
|
h = sha256(history.encode())
|
||||||
return hexlify(h)
|
return hexlify(h)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_local_history(self, address):
|
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 ''
|
history = address_details['history'] or ''
|
||||||
parts = history.split(':')[:-1]
|
parts = history.split(':')[:-1]
|
||||||
return list(zip(parts[0::2], map(int, parts[1::2])))
|
return list(zip(parts[0::2], map(int, parts[1::2])))
|
||||||
|
|
Loading…
Add table
Reference in a new issue