1
0

wallet: rm get_txout_address method

This commit is contained in:
SomberNight
2021-06-08 16:45:30 +02:00
parent 13e4424922
commit 53d6eeb3f3
2 changed files with 3 additions and 6 deletions

View File

@@ -172,9 +172,6 @@ class AddressSynchronizer(Logger):
return tx.outputs()[prevout_n].value
return None
def get_txout_address(self, txo: TxOutput) -> Optional[str]:
return txo.address
def load_unverified_transactions(self):
# review transactions that are in the history
for addr in self.db.get_history():
@@ -271,7 +268,7 @@ class AddressSynchronizer(Logger):
# it could happen that we think tx is unrelated but actually one of the inputs is is_mine.
# this is the main motivation for allow_unrelated
is_mine = any([self.is_mine(self.get_txin_address(txin)) for txin in tx.inputs()])
is_for_me = any([self.is_mine(self.get_txout_address(txo)) for txo in tx.outputs()])
is_for_me = any([self.is_mine(txo.address) for txo in tx.outputs()])
if not is_mine and not is_for_me:
raise UnrelatedTransactionException()
# Find all conflicting transactions.
@@ -325,7 +322,7 @@ class AddressSynchronizer(Logger):
ser = tx_hash + ':%d'%n
scripthash = bitcoin.script_to_scripthash(txo.scriptpubkey.hex())
self.db.add_prevout_by_scripthash(scripthash, prevout=TxOutpoint.from_str(ser), value=v)
addr = self.get_txout_address(txo)
addr = txo.address
if addr and self.is_mine(addr):
self.db.add_txo_addr(tx_hash, addr, n, v, is_coinbase)
self._get_addr_balance_cache.pop(addr, None) # invalidate cache

View File

@@ -2232,7 +2232,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
def receive_tx_callback(self, tx_hash, tx, tx_height):
super().receive_tx_callback(tx_hash, tx, tx_height)
for txo in tx.outputs():
addr = self.get_txout_address(txo)
addr = txo.address
if addr in self.receive_requests:
status = self.get_request_status(addr)
util.trigger_callback('request_status', self, addr, status)