wallet/sql: preserve legacy wallet schema#1289
Open
Roasbeef wants to merge 1 commit into
Open
Conversation
This was referenced Jul 11, 2026
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-migrations
branch
from
July 11, 2026 01:16
4693da9 to
061430e
Compare
In this commit, we add the wallet, scope, account, and address schema shared by the SQLite and PostgreSQL backends. The schema keeps the current dual-passphrase encryption hierarchy, watch-only nullability, encrypted public material, scope account counters, and SHA256 address identifiers. It also persists the sticky used bit directly, so the SQL port does not change gap-limit behavior or require the key-vault rewrite. Extracted-from: bbfe24b Extracted-from: b6b6a7e Extracted-from: 9a313ea Extracted-from: bb5a67b Extracted-from: c5d82b2 Extracted-from: 5a639d4 Extracted-from: 99e40ab Extracted-from: 132ba5b Extracted-from: 47b750b Extracted-from: 69e459b Co-authored-by: yyforyongyu <yong2452@gmail.com>
Roasbeef
force-pushed
the
sql-port-stage1-wallet-schema
branch
from
July 11, 2026 01:16
97c962d to
6ca4b5f
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.
In this PR, we add the port-first wallet, scope, account, and address schema for SQLite and PostgreSQL.
This PR is stacked on #1288, which adds the database connection and migration foundation.
The schema preserves the current dual-passphrase encryption hierarchy and encrypted public material instead of taking the single-passphrase key-vault redesign. It also preserves watch-only nullability, the explicit per-scope last-account counter, the manager creation time, uint32 account identity, SHA256 address identifiers, and all five legacy address row shapes.
Address usage remains a sticky persisted bit. We do not derive it from surviving UTXOs, since the KV wallet can mark an address used after the relevant transaction history is no longer available. This keeps
LastUnusedAddressand gap-limit behavior stable across a later migration.No wallet API, signer interface, PSBT flow, or runtime control path changes here.
Verification: