Set expect_seed after creation.

BCH must be reseeded manually as sethdseed is disabled during IBD.
This commit is contained in:
tecnovert 2025-03-31 00:12:51 +02:00
parent a0c31fb87d
commit 9c252323be
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
2 changed files with 7 additions and 1 deletions
basicswap
tests/basicswap

View file

@ -2665,7 +2665,8 @@ class BasicSwap(BaseApp):
self.log.warning(msg)
return False
expect_seedid = self.getStringKV("main_wallet_seedid_" + ci.coin_name().lower())
seed_key: str = "main_wallet_seedid_" + ci.coin_name().lower()
expect_seedid: str = self.getStringKV(seed_key)
if expect_seedid is None:
self.log.warning(
f"Can't find expected wallet seed id for coin {ci.coin_name()}."
@ -2677,6 +2678,7 @@ class BasicSwap(BaseApp):
)
root_key = self.getWalletKey(c, 1)
self.storeSeedIDForCoin(root_key, c)
expect_seedid: str = self.getStringKV(seed_key)
else:
self.log.warning("Node is locked.")
return False

View file

@ -488,6 +488,10 @@ class TestBCH(BasicSwapTest):
new_wallet_name = random.randbytes(10).hex()
self.callnoderpc("createwallet", [new_wallet_name])
self.callnoderpc("sethdseed", [True, test_wif], wallet=new_wallet_name)
wi = self.callnoderpc("getwalletinfo", wallet=new_wallet_name)
assert wi["hdseedid"] == "3da5c0af91879e8ce97d9a843874601c08688078"
addr = self.callnoderpc("getnewaddress", wallet=new_wallet_name)
self.callnoderpc("unloadwallet", [new_wallet_name])
assert addr == "bchreg:qqxr67wf5ltty5jvm44zryywmpt7ntdaa50carjt59"