twallet: address_is_old is now checked using SPV (during sync) - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 9c31c1f970d9bc371ed2dcba26354c71c6ec8756 DIR parent b2920db8b8a10600e8851317118699b34ba926d8 HTML Author: SomberNight <somber.night@protonmail.com> Date: Tue, 10 Sep 2019 18:26:09 +0200 wallet: address_is_old is now checked using SPV (during sync) Diffstat: M electrum/wallet.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) --- DIR diff --git a/electrum/wallet.py b/electrum/wallet.py t@@ -976,17 +976,18 @@ class Abstract_Wallet(AddressSynchronizer): return not self.is_watching_only() and hasattr(self.keystore, 'get_private_key') def address_is_old(self, address: str, *, req_conf: int = 3) -> bool: - """Returns whether address has any history that is deeply confirmed. - - Note: this is NOT verified using SPV. (TODO should it be?) - """ + """Returns whether address has any history that is deeply confirmed.""" max_conf = -1 h = self.db.get_addr_history(address) + needs_spv_check = not self.config.get("skipmerklecheck", False) for tx_hash, tx_height in h: - if tx_height <= 0: - tx_age = 0 + if needs_spv_check: + tx_age = self.get_tx_height(tx_hash).conf else: - tx_age = self.get_local_height() - tx_height + 1 + if tx_height <= 0: + tx_age = 0 + else: + tx_age = self.get_local_height() - tx_height + 1 max_conf = max(max_conf, tx_age) return max_conf >= req_conf