Skip to content

Remove the legacy wallet and BDB dependency#28710

Merged
fanquake merged 9 commits into
bitcoin:masterfrom
achow101:rm-legacy-wallet
May 7, 2025
Merged

Remove the legacy wallet and BDB dependency#28710
fanquake merged 9 commits into
bitcoin:masterfrom
achow101:rm-legacy-wallet

Conversation

@achow101

@achow101 achow101 commented Oct 23, 2023

Copy link
Copy Markdown
Member

The final step of #20160.

A bare minimum of legacy wallet code is kept in order to perform wallet migration. Migration of legacy wallets uses the independent BDB parser and a minimal LegacyDataSPKM that allows the legacy data to be loaded so that the migration can be completed.

BDB has been removed as a dependency and documentation have been updated to reflect that.

@DrahtBot

DrahtBot commented Oct 23, 2023

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/28710.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK w0xlt, Sjors, maflcko
Concept ACK rkrux

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #32297 (bitcoin-cli: Add -ipcconnect option by ryanofsky)
  • #32238 (qt, wallet: Convert uint256 to Txid by marcofleon)
  • #32189 (refactor: Txid type safety (parent PR) by marcofleon)
  • #31989 (BIP-119 (OP_CHECKTEMPLATEVERIFY) (regtest only) by jamesob)
  • #31895 (doc: Improve dependencies.md by NicolaLS)
  • #31802 (Add bitcoin-{node,gui} to release binaries for IPC by Sjors)
  • #31679 (cmake: Move internal binaries from bin/ to libexec/ by ryanofsky)
  • #31665 (build: Make config warnings fatal if -DWCONFIGURE_ERROR=ON by davidgumberg)
  • #31650 (refactor: Avoid copies by using const references or by move-construction by maflcko)
  • #31622 (psbt: add non-default sighash types to PSBTs and unify sighash type match checking by achow101)
  • #31453 (util: detect and warn when using exFAT on MacOS by willcl-ark)
  • #31404 (descriptors: inference process, do not return unparsable multisig descriptors by furszy)
  • #31375 (multiprocess: Add bitcoin wrapper executable by ryanofsky)
  • #31360 (depends: Avoid using helper variables in toolchain file by hebasto)
  • #31296 (wallet: Translate [default wallet] string in progress messages by ryanofsky)
  • #31275 (doc: corrected lockunspent rpc quoting by Talej)
  • #30595 (kernel: Introduce initial C header API by TheCharlatan)
  • #30437 (multiprocess: add bitcoin-mine test program by ryanofsky)
  • #30221 (wallet: Ensure best block matches wallet scan state by achow101)
  • #29694 (fuzz: wallet: add target for spkm migration by brunoerg)
  • #29675 (wallet: Be able to receive and spend inputs involving MuSig2 aggregate keys by achow101)
  • #29652 (wallet: Avoid potentially writing incorrect best block locator by ryanofsky)
  • #29641 (scripted-diff: Use LogInfo over LogPrintf [WIP, NOMERGE, DRAFT] by maflcko)
  • #29136 (wallet: addhdkey RPC to add just keys to wallets via new void(KEY) descriptor by achow101)
  • #28333 (wallet: Construct ScriptPubKeyMans with all data rather than loaded progressively by achow101)
  • #27865 (wallet: Track no-longer-spendable TXOs separately by achow101)
  • #27286 (wallet: Keep track of the wallet's own transaction outputs in memory by achow101)
  • #21283 (Implement BIP 370 PSBTv2 by achow101)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

LLM Linter (✨ experimental)

Possible typos and grammar issues:

  • by an rescanblockchain -> by a rescanblockchain [Incorrect article "an" used before a word starting with a consonant sound]

This was referenced Oct 24, 2023
Comment thread src/wallet/wallettool.cpp Outdated

@w0xlt w0xlt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK be3c13a with 2 non-blocking nits commented earlier.

Regarding the removed RPC functions, I think less is better in this case, and unless I'm missing something, the cases mentioned in #30175 can be performed by importdescriptors.

achow101 added 4 commits May 6, 2025 16:53
Deletes LegacyScriptPubKeyMan and related tests

Best reviewed with `git diff --patience` or `git diff --histogram`
SOme db functions were for BDB, these are no longer needed.

@w0xlt w0xlt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reACK de054df

@Sjors

Sjors commented May 7, 2025

Copy link
Copy Markdown
Member

re-ACK de054df

@rkrux rkrux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK de054df

Couple of points in 8ede6de, can be done in follow up if no more changes being done in this PR.

Comment on lines -949 to +955
"\nStops current wallet rescan triggered by an RPC call, e.g. by an importprivkey call.\n"
"\nStops current wallet rescan triggered by an RPC call, e.g. by an rescanblockchain call.\n"
"Note: Use \"getwalletinfo\" to query the scanning progress.\n",
{},
RPCResult{RPCResult::Type::BOOL, "", "Whether the abort was successful"},
RPCExamples{
"\nImport a private key\n"
+ HelpExampleCli("importprivkey", "\"mykey\"") +
+ HelpExampleCli("rescanblockchain", "") +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the typo s/an/a above, the comment "Import a private key" doesn't go well with rescanblockchain.

Comment thread src/wallet/rpc/backup.cpp
}

// Only single key descriptors are allowed to be imported to a legacy wallet's keypool
bool can_keypool = parsed_descs.at(0)->IsSingleKey();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #31243, IsSingleKey was added with a TODO to remove it after removing legacy wallets.
I checked that no other usage of IsSingleKey is left, it can be removed.

/** Whether this descriptor only produces single key scripts (i.e. pk(), pkh(), wpkh(), sh() and wsh() nested of those, and combo())
* TODO: Remove this method once legacy wallets are removed as it is only necessary for importmulti.
*/
virtual bool IsSingleKey() const = 0;

@maflcko

maflcko commented May 7, 2025

Copy link
Copy Markdown
Member

re-ACK de054df 🔗

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: re-ACK de054df6dc32cbd8b127c6761d9c65d95025e08 🔗
BCpwbQ/aUjnaK6cKbU2NA6V6EpINW1XAGCEG7C6Kp8TVtlZz/xsxtLcBwdx6KWznzxX0v4qc0hC17WfOYE41CA==

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

post-merge ACK de054df

@maflcko

maflcko commented May 7, 2025

Copy link
Copy Markdown
Member

follow-up in #32438

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.