wallet: (sanity) is_mine now guaranteed to handle 'None' input
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user