Browse Source

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

hard-fail-on-bad-server-string
SomberNight 5 years ago
parent
commit
0d33da2f95
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 7
      electrum/address_synchronizer.py
  2. 2
      electrum/wallet.py

7
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):

2
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]:

Loading…
Cancel
Save