Skip to content

Commit 53d6eeb

Browse files
committed
wallet: rm get_txout_address method
1 parent 13e4424 commit 53d6eeb

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

electrum/address_synchronizer.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ def get_txin_value(self, txin: TxInput, *, address: str = None) -> Optional[int]
172172
return tx.outputs()[prevout_n].value
173173
return None
174174

175-
def get_txout_address(self, txo: TxOutput) -> Optional[str]:
176-
return txo.address
177-
178175
def load_unverified_transactions(self):
179176
# review transactions that are in the history
180177
for addr in self.db.get_history():
@@ -271,7 +268,7 @@ def add_transaction(self, tx: Transaction, *, allow_unrelated=False) -> bool:
271268
# it could happen that we think tx is unrelated but actually one of the inputs is is_mine.
272269
# this is the main motivation for allow_unrelated
273270
is_mine = any([self.is_mine(self.get_txin_address(txin)) for txin in tx.inputs()])
274-
is_for_me = any([self.is_mine(self.get_txout_address(txo)) for txo in tx.outputs()])
271+
is_for_me = any([self.is_mine(txo.address) for txo in tx.outputs()])
275272
if not is_mine and not is_for_me:
276273
raise UnrelatedTransactionException()
277274
# Find all conflicting transactions.
@@ -325,7 +322,7 @@ def add_value_from_prev_output():
325322
ser = tx_hash + ':%d'%n
326323
scripthash = bitcoin.script_to_scripthash(txo.scriptpubkey.hex())
327324
self.db.add_prevout_by_scripthash(scripthash, prevout=TxOutpoint.from_str(ser), value=v)
328-
addr = self.get_txout_address(txo)
325+
addr = txo.address
329326
if addr and self.is_mine(addr):
330327
self.db.add_txo_addr(tx_hash, addr, n, v, is_coinbase)
331328
self._get_addr_balance_cache.pop(addr, None) # invalidate cache

electrum/wallet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2232,7 +2232,7 @@ def export_invoice(self, x: Invoice) -> Dict[str, Any]:
22322232
def receive_tx_callback(self, tx_hash, tx, tx_height):
22332233
super().receive_tx_callback(tx_hash, tx, tx_height)
22342234
for txo in tx.outputs():
2235-
addr = self.get_txout_address(txo)
2235+
addr = txo.address
22362236
if addr in self.receive_requests:
22372237
status = self.get_request_status(addr)
22382238
util.trigger_callback('request_status', self, addr, status)

0 commit comments

Comments
 (0)