wallet: migrate tx reader to db.Store#1202
Draft
yyforyongyu wants to merge 12 commits intoimpl-tx-writer-storefrom
Draft
wallet: migrate tx reader to db.Store#1202yyforyongyu wants to merge 12 commits intoimpl-tx-writer-storefrom
yyforyongyu wants to merge 12 commits intoimpl-tx-writer-storefrom
Conversation
cff5271 to
a35e9f8
Compare
72b3c4b to
fdf6435
Compare
a35e9f8 to
61240bd
Compare
fdf6435 to
850ec52
Compare
850ec52 to
6f767cb
Compare
Add normalized owned-input and owned-output detail queries for SQLite and Postgres, then regenerate sqlc so the transaction reader work can build on a stable query shape. Keep the existing summary APIs unchanged and defer the richer read-model wiring to the follow-up commits.
Adapt the legacy wtxmgr transaction lookup into the db-native summary model. This lets the wallet reader use a fast path without depending on detail reads.
Adapt the legacy range iterator into the db-native transaction summary API. Preserve the existing kvdb range semantics so the wallet reader can use store.ListTxns for its fast path.
61240bd to
921f6d3
Compare
6f767cb to
1efb8cf
Compare
Change the TxReader surface to use query structs on the existing GetTx and ListTxns methods. Keep the implementation on the legacy detailed reader path until the summary and store-backed migrations land in later commits.
Use the new query-based GetTx API to serve summary reads from db.Store.GetTx while leaving the detailed path on the legacy reader for now. This lands the lightweight single-transaction fast path before the store-backed detailed path arrives.
Introduce the db-native transaction detail types and add the GetTxDetail method to the transaction store surface. Implement the SQL-backed single-transaction detail read, teach the kvdb adapter to provide the same shape, and keep the mock store aligned with the expanded interface.
Use the query-based GetTx API to load detailed transaction views from db.Store.GetTxDetail. This removes the remaining legacy GetTx read path while keeping the range reader on its older implementation for now.
Add db-native ranged transaction detail queries and store methods so the query-based tx reader can fetch detailed history without the legacy range builder. Keep the kvdb adapter and wallet test mocks aligned with the expanded store surface.
Use the query-based ListTxns API to serve summary history reads from db.Store.ListTxns while preserving the legacy detailed range reader. This adds the wallet-side range normalization needed for the lightweight history path.
Use the query-based ListTxns API to load detailed history from db.Store.ListTxDetails. This removes the remaining legacy ListTxns read path while leaving the helper cleanup for the final follow-up commits.
Move the legacy fetchTxDetails helper out of tx_reader.go so PSBT compatibility can keep using it without leaving walletdb imports in the store-backed tx-reader implementation. This is a compatibility-only file move with no behavior changes for existing helper callers.
1efb8cf to
edf986b
Compare
Drop the dead production builder path from tx_reader.go now that the query-based GetTx and ListTxns flows both use db.Store-backed transaction shapes. Keep fetchTxDetails in the legacy helper file so non-reader callers still have a compatibility path.
af32521 to
d2477fd
Compare
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.
Summary
wallet.GetTxandwallet.ListTxnsto store-backed detail reads while preserving the publicTxDetailAPIfetchTxDetailshelper intowallet/txdetails_legacy.goso PSBT compatibility can keep using it without leaving legacy DB access inwallet/tx_reader.goTesting
GOWORK=off go test ./wallet/internal/db/kvdb ./wallet -run 'TestGetTxDetail|TestGetTxSuccess|TestGetTxNotFound|TestBuildTxDetail|TestListTxnsSuccess'GOWORK=off go test ./wallet/internal/db/... ./walletGOWORK=off go test ./...inwtxmgrGOWORK=off go test ./...inwaddrmgrGOWORK=off make lint-checkBenchmarks
-7.08%+0.35%+0.29%