wallet: prototype Store-backed SQL runtime - #1299
Closed
yyforyongyu wants to merge 2 commits into
Closed
Conversation
Add an experimental Store-backed wallet path over the SQL manager and transaction stores. Cover lifecycle, recovery, funding, signing, PSBT, lnd-facing key operations, and transaction-boundary failure injection. This preserves the decision PoC and its benchmarks for review. The adapter remains experimental and is not the selected production direction.
Separate database open, runtime activation, and full-block backlog catch-up. Compare deterministic 100, 1,000, and 10,000 block workloads with equivalent SQLite settings and semantic validation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Description
This draft PR is stacked on #1296 and evaluates whether btcwallet's existing
wallet facade can operate directly over the backend-neutral SQL Stores.
It follows the compatibility-first approach:
wallet.Wallet,wallet.Loader, andwaddrmgrruntime.
SQLWallet.Scope
The prototype covers:
The prototype splits several long-running operations into read, compute, and
write phases:
outside Store transactions.
This materially improves SQLite lock behavior:
3.0 ms.
to finish in approximately 4.2-4.5 ms.
and 22.3 ms p99.
The branch contains 96 files with approximately 21,437 additions and 1,717
deletions.
Issues Found
The experiment demonstrates that adapting the existing wallet requires more
than replacing its storage operations.
An independent Store-callback audit found these remaining issues:
and script validation.
maturity decisions.
the complete atomic write set.
publishing the corresponding live secret or cache state.
succeeds.
logging, dynamic callback dispatch, or unbounded work.
Correcting these issues requires systematic prepare, commit, and reconcile
semantics across wallet lifecycle, recovery, imports, keys, transactions, and
notifications.
This removes the expected implementation-size and schedule advantage of the
compatibility-first approach.
Conclusion
The prototype proves that the existing wallet can operate over native SQL
storage without using
SQLWalletor emulating walletdb buckets.It also shows that making this architecture safe requires introducing
role-style transaction ownership throughout the legacy wallet. Continuing the
adapter would effectively rebuild the role-based persistence model behind the
existing facade while retaining duplicated KV and Store paths.
The role-based native SQL wallet is therefore the preferred production
direction. This branch is preserved as a decision PoC and as a source of
behavioral, contention, failure-injection, and synchronization acceptance tests.
It is not proposed as the production implementation.