URI: 
       twallet: address_is_old minor clean-up - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit d1dea9343e5e636c59cf8de6c9d0b5cca1031c44
   DIR parent ccc1897f36b3f8017b669dd15e38c96534a6d524
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Mon,  9 Sep 2019 01:34:29 +0200
       
       wallet: address_is_old minor clean-up
       
       also, synchronize was defined twice in AddressSynchronizer
       
       Diffstat:
         M electrum/address_synchronizer.py    |       3 ---
         M electrum/wallet.py                  |      14 +++++++++-----
       
       2 files changed, 9 insertions(+), 8 deletions(-)
       ---
   DIR diff --git a/electrum/address_synchronizer.py b/electrum/address_synchronizer.py
       t@@ -96,9 +96,6 @@ class AddressSynchronizer(Logger):
                self.load_unverified_transactions()
                self.remove_local_transactions_we_dont_have()
        
       -    def synchronize(self):
       -        pass
       -
            def is_mine(self, address) -> bool:
                return self.db.is_addr_in_history(address)
        
   DIR diff --git a/electrum/wallet.py b/electrum/wallet.py
       t@@ -973,17 +973,20 @@ class Abstract_Wallet(AddressSynchronizer):
            def can_export(self):
                return not self.is_watching_only() and hasattr(self.keystore, 'get_private_key')
        
       -    def address_is_old(self, address, age_limit=2):
       -        age = -1
       +    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?)
       +        """
       +        max_conf = -1
                h = self.db.get_addr_history(address)
                for tx_hash, tx_height in h:
                    if tx_height <= 0:
                        tx_age = 0
                    else:
                        tx_age = self.get_local_height() - tx_height + 1
       -            if tx_age > age:
       -                age = tx_age
       -        return age > age_limit
       +            max_conf = max(max_conf, tx_age)
       +        return max_conf >= req_conf
        
            def bump_fee(self, *, tx, new_fee_rate, config) -> Transaction:
                """Increase the miner fee of 'tx'.
       t@@ -1889,6 +1892,7 @@ class Deterministic_Wallet(Abstract_Wallet):
                    else:
                        break
        
       +    @AddressSynchronizer.with_local_height_cached
            def synchronize(self):
                with self.lock:
                    self.synchronize_sequence(False)