1
0

wallet_db: WalletDB.get_txo_addr now returns dict instead of list

This commit is contained in:
SomberNight
2020-10-16 21:51:01 +02:00
parent e71fa4924f
commit da6080421e
2 changed files with 25 additions and 23 deletions

View File

@@ -794,12 +794,12 @@ class WalletDB(JsonDB):
return list(d.items())
@locked
def get_txo_addr(self, tx_hash: str, address: str) -> Iterable[Tuple[int, int, bool]]:
"""Returns an iterable of (output_index, value, is_coinbase)."""
def get_txo_addr(self, tx_hash: str, address: str) -> Dict[int, Tuple[int, bool]]:
"""Returns a dict: output_index -> (value, is_coinbase)."""
assert isinstance(tx_hash, str)
assert isinstance(address, str)
d = self.txo.get(tx_hash, {}).get(address, {})
return [(int(n), v, cb) for (n, (v, cb)) in d.items()]
return {int(n): (v, cb) for (n, (v, cb)) in d.items()}
@modifier
def add_txi_addr(self, tx_hash: str, addr: str, ser: str, v: int) -> None: