Browse Source

wallet: rm get_txout_address method

patch-4
SomberNight 4 years ago
parent
commit
53d6eeb3f3
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 7
      electrum/address_synchronizer.py
  2. 2
      electrum/wallet.py

7
electrum/address_synchronizer.py

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

2
electrum/wallet.py

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

Loading…
Cancel
Save