Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the legacy wallet and BDB dependency #28710

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

achow101
Copy link
Member

@achow101 achow101 commented Oct 23, 2023

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.

All tests which tested legacy wallet behavior have been removed. The --descriptors and --legacy-wallet options are removed from the functional tests.

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

Depends on #26596, bitcoin-core/gui#824, #30265, #30328, and #31250

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 23, 2023

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.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #31613 (depends, NetBSD: Fix bdb package compilation with GCC-14 by hebasto)
  • #31609 (test: importdescriptors is not available for non-descriptor wallets by brunoerg)
  • #31603 (descriptor: check whitespace in ParsePubkeyInner by brunoerg)
  • #31519 (refactor: Use std::span over Span by maflcko)
  • #31507 ([POC] build: Use clang-cl to build on Windows natively by hebasto)
  • #31495 (wallet: Utilize IsMine() and CanProvide() in migration to cover edge cases by achow101)
  • #31453 (util: detect and warn when using exFAT on MacOS by willcl-ark)
  • #31451 (wallet: migration, avoid loading legacy wallet after failure when BDB isn't compiled by furszy)
  • #31423 (wallet: migration, don't create spendable wallet from a watch-only legacy wallet by furszy)
  • #31416 (doc: Fix incorrect send RPC docs by maflcko)
  • #31413 (rpc: Remove deprecated dummy alias for listtransactions::label by maflcko)
  • #31404 (descriptors: inference process, do not return unparsable multisig descriptors by furszy)
  • #31398 (wallet: refactor: various master key encryption cleanups by theStack)
  • #31375 (multiprocess: Add bitcoin wrapper executable by ryanofsky)
  • #31360 (depends: Avoid using helper variables in toolchain file by hebasto)
  • #31353 (rpc, cli: add getbalances#total, and use it for -getinfo by jonatack)
  • #31296 (wallet: Translate [default wallet] string in progress messages by ryanofsky)
  • #31282 (refactor: Make node_id a const& in RemoveBlockRequest by maflcko)
  • #31278 (wallet, rpc: Settxfeerate by polespinasa)
  • #31275 (doc: corrected lockunspent rpc quoting by Talej)
  • #31250 (wallet: Disable creating and loading legacy wallets by achow101)
  • #31244 (descriptors: MuSig2 by achow101)
  • #31243 (descriptor: Move filling of keys from DescriptorImpl::MakeScripts to PubkeyProvider::GetPubKey by achow101)
  • #31242 (wallet, desc spkm: Return SigningProvider only if we have the privkey by achow101)
  • #31241 (wallet: remove BDB dependency from wallet migration benchmark by furszy)
  • #31176 (ci: Test cross-built Windows executables on Windows natively by hebasto)
  • #31158 (build, ci: Fix linking bitcoin-chainstate.exe to bitcoinkernel.dll on Windows by hebasto)
  • #31061 (refactor: Check translatable format strings at compile-time by maflcko)
  • #30997 (build: Switch to Qt 6 by hebasto)
  • #30975 (Add multiprocess binaries to release build by Sjors)
  • #30860 (test: autogenerate bash completion by BrandonOdiwuor)
  • #30844 (RPC: improve SFFO arg parsing, error catching and coverage by furszy)
  • #30727 (rpc: add address_type field in getaddressinfo by jonatack)
  • #30437 (multiprocess: add bitcoin-mine test program by ryanofsky)
  • #30343 (wallet, logging: Replace WalletLogPrintf() with LogInfo() by ryanofsky)
  • #30221 (wallet: Ensure best block matches wallet scan state by achow101)
  • #30125 (test: improve BDB parser (handle internal/overflow pages, support all page sizes) by theStack)
  • #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)
  • #29156 (tests: add functional test for miniscript decaying multisig by mjdietzx)
  • #29136 (wallet: addhdkey RPC to add just keys to wallets via new void(KEY) descriptor by achow101)
  • #29124 (wallet: Automatically repair corrupted metadata with doubled derivation path by achow101)
  • #28944 (wallet, rpc: add anti-fee-sniping to send and sendall by ishaanam)
  • #28802 (ArgsManager: support subcommand-specific options by ajtowns)
  • #28724 (wallet: Cleanup accidental encryption keys in watchonly wallets 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)
  • #27052 (test: rpc: add last block announcement time to getpeerinfo result by LarryRuane)
  • #25722 (refactor: Use util::Result class for wallet loading by ryanofsky)
  • #21283 (Implement BIP 370 PSBTv2 by achow101)
  • #19461 (multiprocess: Add bitcoin-gui -ipcconnect option by ryanofsky)
  • #19460 (multiprocess: Add bitcoin-wallet -ipcconnect option by ryanofsky)
  • #10102 (Multiprocess bitcoin by ryanofsky)

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.

This was referenced Oct 24, 2023
Salvage is bdb only which is about to be removed.
We can't load legacy wallet anymore, so if migration fails, don't try to
load the failed wallet.
Require sqlite is available in order to compile the wallet. Removes
instances of USE_SQLITE since it is no longer possible to not have
sqlite available.
Legacy wallets do not have the descriptors flag set. Don't load wallets
without the descriptors flag.

At the same time, we will no longer load BDB databases since they are
only used for legacy wallets.
This function will be needed in migration
Instead of (partially) trying to reverse IsMine() to get the output
scripts that a LegacySPKM would track, we can preserve it in migration
only code and utilize it to get an accurate set of output scripts.

This is accomplished by computing a set of output script candidates from
map(Crypted)Keys, mapScripts, and setWatchOnly. This candidate set is an
upper bound on the scripts tracked by the wallet. Then IsMine() is used
to filter to the exact output scripts that LegacySPKM would track.

By changing GetScriptPubKeys() this way, we can avoid complexities in
reversing IsMine() and get a more complete set of output scripts.
InferDescriptors can sometimes make descriptors which are actually
invalid and cannot be parsed. Detect and skip such descriptors by doing
a Parse() check before adding the descriptor to the wallet.
LegacySPKM would determine whether it could provide any script data to a
transaction through the use of the CanProvide function. Instead of
partially reversing signing logic to figure out the output scripts of
solvable things, we use the same candidate set approach in
GetScriptPubKeys() and instead filter the candidate set first for
things that are ISMINE_NO, and second with CanProvide(). This should
give a more accurate solvables wallet.
The legacy wallet will be able to solve output scripts where the
redeemScript or witnessScript is known, but does not know any of the
private keys involved in that script. These should be migrated to the
solvables wallet.
Deletes LegacyScriptPubKeyMan and related tests
SOme db functions were for BDB, these are no longer needed.
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.

7 participants