bitcoin/src/script
Andrew Chow 7921026a24
Merge bitcoin/bitcoin#19602: wallet: Migrate legacy wallets to descriptor wallets
53e7ed075c doc: Release notes and other docs for migration (Andrew Chow)
9c44bfe244 Test migratewallet (Andrew Chow)
0b26e7cdf2 descriptors: addr() and raw() should return false for ToPrivateString (Andrew Chow)
31764c3f87 Add migratewallet RPC (Andrew Chow)
0bf7b38bff Implement MigrateLegacyToDescriptor (Andrew Chow)
e7b16f925a Implement MigrateToSQLite (Andrew Chow)
5b62f095e7 wallet: Refactor SetupDescSPKMs to take CExtKey (Andrew Chow)
22401f17e0 Implement LegacyScriptPubKeyMan::DeleteRecords (Andrew Chow)
35f428fae6 Implement LegacyScriptPubKeyMan::MigrateToDescriptor (Andrew Chow)
ea1ab390e4 scriptpubkeyman: Implement GetScriptPubKeys in Legacy (Andrew Chow)
e664af2976 Apply label to all scriptPubKeys of imported combo() (Andrew Chow)

Pull request description:

  This PR adds a new `migratewallet` RPC which migrates a legacy wallet to a descriptor wallet. Migrated wallets will need a new backup. If a wallet has watchonly stuff in it, a new watchonly descriptor wallet will be created containing those watchonly things. The related transactions, labels, and descriptors for those watchonly things will be removed from the original wallet. Migrated wallets will not have any of the legacy things be available for fetching from `getnewaddress` or `getrawchangeaddress`. Wallets that have private keys enabled will have newly generated descriptors. Wallets with private keys disabled will not have any active `ScriptPubKeyMan`s.

  For the basic HD wallet case of just generated keys, in addition to the standard descriptor wallet descriptors using the master key derived from the pre-existing hd seed, the migration will also create 3 descriptors for each HD chain in: a ranged combo external, a ranged combo internal, and a single key combo for the seed (the seed is a valid key that we can receive coins at!). The migrated wallet will then have newly generated descriptors as the active `ScriptPubKeyMan`s. This is equivalent to creating a new descriptor wallet and importing the 3 descriptors for each HD chain. For wallets containing non-HD keys, each key will have its own combo descriptor.

  There are also tests.

ACKs for top commit:
  Sjors:
    tACK 53e7ed075c
  w0xlt:
    reACK 53e7ed075c

Tree-SHA512: c0c003694ca2e17064922d08e8464278d314e970efb7df874b4fe04ec5d124c7206409ca701c65c099d17779ab2136ae63f1da2a9dba39b45f6d62cf93b5c60a
2022-09-01 15:43:30 -04:00
..
bitcoinconsensus.cpp Use spans of std::byte in serialize 2022-01-02 11:40:31 +01:00
bitcoinconsensus.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
descriptor.cpp Merge bitcoin/bitcoin#19602: wallet: Migrate legacy wallets to descriptor wallets 2022-09-01 15:43:30 -04:00
descriptor.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
interpreter.cpp Use HashWriter where possible 2022-07-20 15:34:36 +02:00
interpreter.h Make DUMMY_CHECKER availble outside of script/sign.cpp 2022-08-19 14:37:36 -04:00
keyorigin.h Implement operator< for KeyOriginInfo and CExtPubKey 2021-12-10 08:29:47 -05:00
miniscript.cpp miniscript: nit: don't return after assert(false) 2022-05-30 15:16:45 +02:00
miniscript.h miniscript: add a helper to find the first insane sub with no child 2022-07-14 12:03:49 +02:00
script.cpp script: move CheckMinimalPush from interpreter to script.h 2022-03-17 14:09:06 +01:00
script.h script: actually trigger the optimization in BuildScript 2022-07-26 13:02:48 +02:00
script_error.cpp Implement Tapscript script validation rules (BIP 342) 2020-10-12 17:18:24 -07:00
script_error.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
sigcache.cpp validationcaches: Use size_t for sizes 2022-08-03 12:03:28 -04:00
sigcache.h validationcaches: Use size_t for sizes 2022-08-03 12:03:28 -04:00
sign.cpp Make DUMMY_CHECKER availble outside of script/sign.cpp 2022-08-19 14:37:36 -04:00
sign.h Make DUMMY_CHECKER availble outside of script/sign.cpp 2022-08-19 14:37:36 -04:00
signingprovider.cpp refactor: Avoid copies in FlatSigningProvider Merge 2022-08-12 17:19:16 +02:00
signingprovider.h refactor: Avoid copies in FlatSigningProvider Merge 2022-08-12 17:19:16 +02:00
standard.cpp Remove ::g_max_datacarrier_bytes global 2022-08-02 15:29:16 +02:00
standard.h Remove ::g_max_datacarrier_bytes global 2022-08-02 15:29:16 +02:00