wallet/sql: preserve transaction store semantics#1290
Open
Roasbeef wants to merge 1 commit into
Open
Conversation
Roasbeef
force-pushed
the
sql-port-stage1-wallet-schema
branch
from
July 11, 2026 00:47
a5a60ca to
97c962d
Compare
Roasbeef
force-pushed
the
sql-port-stage1-transactions
branch
from
July 11, 2026 00:48
335fb7f to
0c4c46d
Compare
Roasbeef
force-pushed
the
sql-port-stage1-wallet-schema
branch
from
July 11, 2026 01:16
97c962d to
6ca4b5f
Compare
In this commit, we add the transaction, input, credit, and output lease schema shared by the SQLite and PostgreSQL backends. The schema models active mined and unmined incidences instead of retaining rewrite-only status or replacement history. It preserves duplicate mined incidences, multiple unmined spenders, hash-scoped labels, the credit change bit, actual output scripts, and outpoint-scoped leases from the current wtxmgr contract. Extracted-from: 2fed11b Extracted-from: 7e9b31e Extracted-from: a9d660f Extracted-from: 91802d2 Extracted-from: 34a3539 Extracted-from: 5495079 Extracted-from: ca2f716 Extracted-from: 7f4149f Extracted-from: 0087d38 Extracted-from: 50acc9c Extracted-from: aa826c6 Extracted-from: 66e09f2 Extracted-from: c421300 Extracted-from: ff2577a Extracted-from: 5b1e64a Extracted-from: 95a09f5 Co-authored-by: Josh Rickmar <jrick@conformal.com> Co-authored-by: Wilmer Paulino <wilmer.paulino@gmail.com> Co-authored-by: Joost Jager <joost.jager@gmail.com>
Roasbeef
force-pushed
the
sql-port-stage1-transactions
branch
from
July 11, 2026 01:17
0c4c46d to
cbfffef
Compare
This was referenced Jul 14, 2026
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.
In this PR, we add the port-first transaction, input, credit, and output lease schema for SQLite and PostgreSQL.
This PR is stacked on #1289, which preserves the legacy wallet, scope, account, and address schema.
The long-running branch had moved to a replacement-history state machine that current
wtxmgrdoes not expose. This PR keeps the current model instead: active mined and unmined incidences, physical conflict removal, duplicate mined incidences across blocks, and multiple unmined spenders for one outpoint. The rewrite-only replacement table is deferred.Credits retain the observable change bit and actual transaction output script. A canonical credit-incidence relation keeps duplicate mined incidences from duplicating one UTXO, while an exact mined debit relation preserves incidence-specific spent state. Labels remain keyed by transaction hash and survive incidence deletion. Leases remain keyed by outpoint, use Unix-second expiry, and can exist independently of a credit row. Atomic lease acquisition preserves same-ID renewal, expired takeover, and rejection of a different live lock ID.
This completes the Stage 1 schema foundation. It does not add a store adapter or change wallet control flow.
Verification:
sqlc vet -f sqlc.yamlmake fmt-check tidy-module-check rpc-check sqlc-check./lnwallet/btcwallet,./keychain, and./lnrpc/walletrpc