wallet: Reload watchonly and solvables wallets after migration

When migrating, create the watchonly and solvables wallets without a
context. Then unload and reload them after migration completes, as we do
for the actual wallet.

There is also additional handling for a failed reload.
This commit is contained in:
Andrew Chow
2023-10-06 15:58:13 -04:00
parent 118f2d7d70
commit d616d30ea5
2 changed files with 62 additions and 24 deletions

View File

@@ -848,7 +848,7 @@ class WalletMigrationTest(BitcoinTestFramework):
wallet.addmultisigaddress(2, [wallet.getnewaddress(), get_generate_key().pubkey])
wallet.importaddress(get_generate_key().p2pkh_addr)
assert_raises_rpc_error(-4, "Failed to create new watchonly wallet", wallet.migratewallet)
assert_raises_rpc_error(-4, "Failed to create database", wallet.migratewallet)
assert "failed" in self.nodes[0].listwallets()
assert "failed_watchonly" not in self.nodes[0].listwallets()