From c51f3497acbe64aca6a25afa49cd90e756fa531a Mon Sep 17 00:00:00 2001 From: Kristaps Kaupe Date: Thu, 27 Jul 2023 20:38:37 +0300 Subject: [PATCH] import_addresses_if_needed() first argument is Set not List --- jmclient/jmclient/blockchaininterface.py | 8 ++++---- jmclient/jmclient/wallet_service.py | 4 ++-- jmclient/test/commontest.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/jmclient/jmclient/blockchaininterface.py b/jmclient/jmclient/blockchaininterface.py index cf8342310..34c031666 100644 --- a/jmclient/jmclient/blockchaininterface.py +++ b/jmclient/jmclient/blockchaininterface.py @@ -5,7 +5,7 @@ import time from abc import ABC, abstractmethod from decimal import Decimal -from typing import Callable, Generator, List, Optional, Tuple, Union +from typing import Callable, Generator, List, Optional, Set, Tuple, Union from twisted.internet import reactor, task @@ -70,7 +70,7 @@ def rescanblockchain(self, start_height: int, end_height: Optional[int] = None) """ @abstractmethod - def import_addresses_if_needed(self, addresses: List[str], wallet_name: str) -> bool: + def import_addresses_if_needed(self, addresses: Set[str], wallet_name: str) -> bool: """import addresses to the underlying blockchain interface if needed returns True if the sync call needs to do a system exit""" @@ -462,7 +462,7 @@ def import_addresses(self, addr_list: List[str], wallet_name: str, jmprint(fatal_msg, "important") sys.exit(EXIT_FAILURE) - def import_addresses_if_needed(self, addresses: List[str], wallet_name: str) -> bool: + def import_addresses_if_needed(self, addresses: Set[str], wallet_name: str) -> bool: if wallet_name in self._rpc('listlabels', []): imported_addresses = set(self._rpc('getaddressesbylabel', [wallet_name]).keys()) @@ -695,7 +695,7 @@ def __init__(self, jsonRpc: JsonRpc, network: str, wallet_name: str) -> None: self.wallet_name = None self.scan_result = None - def import_addresses_if_needed(self, addresses: List[str], wallet_name: str) -> bool: + def import_addresses_if_needed(self, addresses: Set[str], wallet_name: str) -> bool: self.import_addresses_call_count += 1 if self.import_addresses_call_count == 1: self.wallet_name = wallet_name diff --git a/jmclient/jmclient/wallet_service.py b/jmclient/jmclient/wallet_service.py index 2a81330a0..bed95b28b 100644 --- a/jmclient/jmclient/wallet_service.py +++ b/jmclient/jmclient/wallet_service.py @@ -4,7 +4,7 @@ import itertools import time import sys -from typing import Optional, Tuple +from typing import Optional, Set, Tuple from decimal import Decimal from copy import deepcopy from twisted.internet import reactor @@ -964,7 +964,7 @@ def get_internal_addr(self, mixdepth): self.import_addr(addr) return addr - def collect_addresses_init(self): + def collect_addresses_init(self) -> Set[str]: """ Collects the "current" set of addresses, as defined by the indices recorded in the wallet's index cache (persisted in the wallet file usually). diff --git a/jmclient/test/commontest.py b/jmclient/test/commontest.py index 46624de62..c5553c5d3 100644 --- a/jmclient/test/commontest.py +++ b/jmclient/test/commontest.py @@ -4,7 +4,7 @@ import os import random from decimal import Decimal -from typing import Callable, List, Optional, Tuple, Union +from typing import Callable, List, Optional, Set, Tuple, Union import jmbitcoin as btc from jmbase import (get_log, hextobin, bintohex, dictchanger) @@ -47,7 +47,7 @@ def is_address_imported(self, addr: str) -> bool: pass def is_address_labeled(self, utxo: dict, walletname: str) -> bool: pass - def import_addresses_if_needed(self, addresses: List[str], wallet_name: str) -> bool: + def import_addresses_if_needed(self, addresses: Set[str], wallet_name: str) -> bool: pass def import_addresses(self, addr_list: List[str], wallet_name: str, restart_cb: Callable[[str], None] = None) -> None: