electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 0d33da2f95951a4b13755927876c9a17b9485f82
parent 07f5d6b74580d05a0e764de6898c1c397edcd7be
Author: SomberNight <somber.night@protonmail.com>
Date:   Wed, 12 Feb 2020 17:07:04 +0100

wallet: (sanity) is_mine now guaranteed to handle 'None' input

Diffstat:
Melectrum/address_synchronizer.py | 7++++---
Melectrum/wallet.py | 2++
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/electrum/address_synchronizer.py b/electrum/address_synchronizer.py @@ -40,7 +40,7 @@ from .logging import Logger if TYPE_CHECKING: from .network import Network - from .json_db import JsonDB + from .wallet_db import WalletDB TX_HEIGHT_FUTURE = -3 @@ -70,7 +70,7 @@ class AddressSynchronizer(Logger): inherited by wallet """ - def __init__(self, db: 'JsonDB'): + def __init__(self, db: 'WalletDB'): self.db = db self.network = None # type: Network Logger.__init__(self) @@ -104,7 +104,8 @@ class AddressSynchronizer(Logger): self.load_unverified_transactions() self.remove_local_transactions_we_dont_have() - def is_mine(self, address) -> bool: + def is_mine(self, address: Optional[str]) -> bool: + if not address: return False return self.db.is_addr_in_history(address) def get_addresses(self): diff --git a/electrum/wallet.py b/electrum/wallet.py @@ -407,6 +407,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC): return def is_mine(self, address) -> bool: + if not address: return False return bool(self.get_address_index(address)) def is_change(self, address) -> bool: @@ -1985,6 +1986,7 @@ class Imported_Wallet(Simple_Wallet): self.save_db() def is_mine(self, address) -> bool: + if not address: return False return self.db.has_imported_address(address) def get_address_index(self, address) -> Optional[str]: