@@ -391,7 +391,6 @@ class Abstract_Wallet(ABC, Logger, EventListener):
391391 """
392392
393393 max_change_outputs = 3
394- gap_limit_for_change = 10
395394
396395 txin_type : str
397396 wallet_type : str
@@ -3814,6 +3813,7 @@ def __init__(self, db, *, config):
38143813 self ._ephemeral_addr_to_addr_index = {} # type: Dict[str, Sequence[int]]
38153814 Abstract_Wallet .__init__ (self , db , config = config )
38163815 self .gap_limit = db .get ('gap_limit' , 20 )
3816+ self .gap_limit_for_change = db .get ('gap_limit_for_change' , 10 )
38173817 # generate addresses now. note that without libsecp this might block
38183818 # for a few seconds!
38193819 self .synchronize ()
@@ -4232,7 +4232,8 @@ def create_new_wallet(
42324232 password : Optional [str ] = None ,
42334233 encrypt_file : bool = True ,
42344234 seed_type : Optional [str ] = None ,
4235- gap_limit : Optional [int ] = None
4235+ gap_limit : Optional [int ] = None ,
4236+ gap_limit_for_change : Optional [int ] = None ,
42364237) -> dict :
42374238 """Create a new wallet"""
42384239 storage = WalletStorage (path , allow_partial_writes = config .WALLET_PARTIAL_WRITES )
@@ -4248,6 +4249,8 @@ def create_new_wallet(
42484249 db .put ('lightning_xprv' , k .get_lightning_xprv (None ))
42494250 if gap_limit is not None :
42504251 db .put ('gap_limit' , gap_limit )
4252+ if gap_limit_for_change is not None :
4253+ db .put ('gap_limit_for_change' , gap_limit_for_change )
42514254 wallet = Wallet (db , config = config )
42524255 wallet .update_password (old_pw = None , new_pw = password , encrypt_storage = encrypt_file )
42534256 wallet .synchronize ()
@@ -4265,6 +4268,7 @@ def restore_wallet_from_text(
42654268 password : Optional [str ] = None ,
42664269 encrypt_file : Optional [bool ] = None ,
42674270 gap_limit : Optional [int ] = None ,
4271+ gap_limit_for_change : Optional [int ] = None ,
42684272) -> dict :
42694273 """Restore a wallet from text. Text can be a seed phrase, a master
42704274 public key, a master private key, a list of bitcoin addresses
@@ -4308,6 +4312,8 @@ def restore_wallet_from_text(
43084312 db .put ('wallet_type' , 'standard' )
43094313 if gap_limit is not None :
43104314 db .put ('gap_limit' , gap_limit )
4315+ if gap_limit_for_change is not None :
4316+ db .put ('gap_limit_for_change' , gap_limit_for_change )
43114317 wallet = Wallet (db , config = config )
43124318 if db .storage :
43134319 assert not db .storage .file_exists (), "file was created too soon! plaintext keys might have been written to disk"
0 commit comments