wallet: clarify difference between wallet.is_mine and adb.is_mine
related https://github.com/spesmilo/electrum/pull/8699
This commit is contained in:
@@ -110,8 +110,14 @@ class AddressSynchronizer(Logger, EventListener):
|
|||||||
self.remove_local_transactions_we_dont_have()
|
self.remove_local_transactions_we_dont_have()
|
||||||
|
|
||||||
def is_mine(self, address: Optional[str]) -> bool:
|
def is_mine(self, address: Optional[str]) -> bool:
|
||||||
"""Returns whether an address is in our set
|
"""Returns whether an address is in our set.
|
||||||
Note: This class has a larget set of addresses than the wallet
|
|
||||||
|
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
|
if not address: return False
|
||||||
return self.db.is_addr_in_history(address)
|
return self.db.is_addr_in_history(address)
|
||||||
|
|||||||
@@ -3089,7 +3089,7 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
|||||||
for txin_idx, txin in enumerate(tx.inputs()):
|
for txin_idx, txin in enumerate(tx.inputs()):
|
||||||
if txin.sighash and txin.sighash != Sighash.ALL: # non-standard
|
if txin.sighash and txin.sighash != Sighash.ALL: # non-standard
|
||||||
addr = self.adb.get_txin_address(txin)
|
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_out = txin.sighash & (Sighash.ANYONECANPAY ^ 0xff)
|
||||||
sh_in = txin.sighash & Sighash.ANYONECANPAY
|
sh_in = txin.sighash & Sighash.ANYONECANPAY
|
||||||
confirm |= hintmap[sh_out][0] | hintmap[sh_in][0]
|
confirm |= hintmap[sh_out][0] | hintmap[sh_in][0]
|
||||||
|
|||||||
Reference in New Issue
Block a user