Skip to content

Commit

Permalink
import_addresses_if_needed() first argument is Set not List
Browse files Browse the repository at this point in the history
  • Loading branch information
kristapsk committed Jul 27, 2023
1 parent dd86234 commit c51f349
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions jmclient/jmclient/blockchaininterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"""

Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions jmclient/jmclient/wallet_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions jmclient/test/commontest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit c51f349

Please sign in to comment.