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