Browse Source

wallet: clarify difference between wallet.is_mine and adb.is_mine

related https://github.com/spesmilo/electrum/pull/8699
master
SomberNight 2 years ago
parent
commit
e1d0247ce4
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 10
      electrum/address_synchronizer.py
  2. 2
      electrum/wallet.py

10
electrum/address_synchronizer.py

@ -110,8 +110,14 @@ class AddressSynchronizer(Logger, EventListener):
self.remove_local_transactions_we_dont_have()
def is_mine(self, address: Optional[str]) -> bool:
"""Returns whether an address is in our set
Note: This class has a larget set of addresses than the wallet
"""Returns whether an address is in our set.
Differences between adb.is_mine and wallet.is_mine:
- adb.is_mine: addrs that we are watching (e.g. via Synchronizer)
- lnwatcher adds its own lightning-related addresses that are not part of the wallet
- wallet.is_mine: addrs that are part of the wallet balance or the wallet might sign for
- an offline wallet might learn from a PSBT about addrs beyond its gap limit
Neither set is guaranteed to be a subset of the other.
"""
if not address: return False
return self.db.is_addr_in_history(address)

2
electrum/wallet.py

@ -3089,7 +3089,7 @@ class Abstract_Wallet(ABC, Logger, EventListener):
for txin_idx, txin in enumerate(tx.inputs()):
if txin.sighash and txin.sighash != Sighash.ALL: # non-standard
addr = self.adb.get_txin_address(txin)
if self.adb.is_mine(addr):
if self.is_mine(addr):
sh_out = txin.sighash & (Sighash.ANYONECANPAY ^ 0xff)
sh_in = txin.sighash & Sighash.ANYONECANPAY
confirm |= hintmap[sh_out][0] | hintmap[sh_in][0]

Loading…
Cancel
Save