Skip to content

Commit 4800a2d

Browse files
committed
wallet: follow-up prev: always set wallet.gap_limit_for_change
even for Imported_Wallet
1 parent 3e8af98 commit 4800a2d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

electrum/wallet.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ class Abstract_Wallet(ABC, Logger, EventListener):
391391
"""
392392

393393
max_change_outputs = 3
394+
gap_limit_for_change = None # type: int | None
394395

395396
txin_type: str
396397
wallet_type: str
@@ -1882,7 +1883,8 @@ def _get_change_addresses_we_can_use_now(
18821883
# if there are none, take one randomly from the last few
18831884
if not allow_reuse:
18841885
return []
1885-
addrs = self.get_change_addresses(slice_start=-self.gap_limit_for_change)
1886+
gap_limit = self.gap_limit_for_change or 0
1887+
addrs = self.get_change_addresses(slice_start=-gap_limit)
18861888
change_addrs = [random.choice(addrs)] if addrs else []
18871889
for addr in change_addrs:
18881890
assert is_address(addr), f"not valid bitcoin address: {addr}"
@@ -3808,6 +3810,7 @@ def decrypt_message(self, pubkey: str, message, password) -> bytes:
38083810

38093811

38103812
class Deterministic_Wallet(Abstract_Wallet):
3813+
gap_limit_for_change: int
38113814

38123815
def __init__(self, db, *, config):
38133816
self._ephemeral_addr_to_addr_index = {} # type: Dict[str, Sequence[int]]

0 commit comments

Comments
 (0)