Merge bitcoin/bitcoin#32597: wallet: Always set descriptor cache upgraded flag for new wallets

47237cd193 wallet, rpc: Output wallet flags in getwalletinfo (Ava Chow)
bc2a26b296 wallet: Add GetWalletFlags (Ava Chow)
69f588a99a wallet: Set upgraded descriptor cache flag for newly created wallets (Ava Chow)

Pull request description:

  Newly created wallets will always have an upgraded descriptor cache, so set those.

  Also, to verify this behavior, add a new `flags` field to `getwalletinfo` and check that in the functional tests.

  Split from #32489

ACKs for top commit:
  Sjors:
    ACK 47237cd193
  w0xlt:
    ACK 47237cd193
  rkrux:
    ACK 47237cd193

Tree-SHA512: 97c7f85b858efe5ced9b8aafb6cd7c1a547de6f8013b82bfc75bc567cf73c9db5e168e3980355756541305520022fd776b8d4d240d3fb34ed86c27d2acaf4863
This commit is contained in:
merge-script
2025-06-25 16:14:01 -04:00
5 changed files with 53 additions and 12 deletions

View File

@@ -104,7 +104,9 @@ class AvoidReuseTest(BitcoinTestFramework):
# Flags should be node1.avoid_reuse=false, node2.avoid_reuse=true
assert_equal(self.nodes[0].getwalletinfo()["avoid_reuse"], False)
assert_equal(sorted(self.nodes[0].getwalletinfo()["flags"]), sorted(["descriptor_wallet", "last_hardened_xpub_cached"]))
assert_equal(self.nodes[1].getwalletinfo()["avoid_reuse"], True)
assert_equal(sorted(self.nodes[1].getwalletinfo()["flags"]), sorted(["descriptor_wallet", "last_hardened_xpub_cached", "avoid_reuse"]))
self.restart_node(1)
self.connect_nodes(0, 1)

View File

@@ -44,6 +44,7 @@ class CreateWalletTest(BitcoinTestFramework):
assert_raises_rpc_error(-4, "Error: This wallet has no available keys", w1.getrawchangeaddress)
import_res = w1.importdescriptors([{"desc": w0.getaddressinfo(address1)['desc'], "timestamp": "now"}])
assert_equal(import_res[0]["success"], True)
assert_equal(sorted(w1.getwalletinfo()["flags"]), sorted(["last_hardened_xpub_cached", "descriptor_wallet", "disable_private_keys"]))
self.log.info('Test that private keys cannot be imported')
privkey, pubkey = generate_keypair(wif=True)