Skip to content

wallet: route filtered-block and scan-batch writes through the Store#1270

Open
yyforyongyu wants to merge 15 commits into
impl-runtime-store-3from
impl-runtime-store-4
Open

wallet: route filtered-block and scan-batch writes through the Store#1270
yyforyongyu wants to merge 15 commits into
impl-runtime-store-3from
impl-runtime-store-4

Conversation

@yyforyongyu

Copy link
Copy Markdown
Collaborator

Routes the wallet chain-scan write path through the runtime db.Store:
filtered block batches, scan-batch params construction, scan-batch and targeted
scan-batch writes, and sync-tip updates in the scan flow, plus the scan-horizon
account-name stamping backport. Includes filtered-block write-shape,
bare-multisig, and third-party-filtering tests.

Split out of the runtime Store PR for reviewability; content-preserving, no
commit changes. Stacked on impl-runtime-store-3 (#1258).

@yyforyongyu yyforyongyu added this to the Introduce SQL store milestone Jun 17, 2026
@yyforyongyu yyforyongyu self-assigned this Jun 17, 2026
@coveralls

coveralls commented Jun 17, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 28448454155

Warning

No base build found for commit c9e08a9 on impl-runtime-store-3.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 56.374%

Details

  • Patch coverage: 94 uncovered changes across 2 files (392 of 486 lines covered, 80.66%).

Uncovered Changes

File Changed Covered %
wallet/syncer.go 445 353 79.33%
wallet/recovery.go 41 39 95.12%

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 59366
Covered Lines: 33467
Line Coverage: 56.37%
Coverage Strength: 9311.72 hits per line

💛 - Coveralls

@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-3 branch from f22553f to f2cd230 Compare June 17, 2026 12:22
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-4 branch from 6fd8846 to 6e49f06 Compare June 17, 2026 12:22
@saubyk saubyk added this to lnd v0.22 Jun 17, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in lnd v0.22 Jun 17, 2026
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-3 branch from f2cd230 to eea1984 Compare June 17, 2026 16:06
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-4 branch from 6e49f06 to ee88d41 Compare June 17, 2026 16:06
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-3 branch from eea1984 to c1d07f0 Compare June 17, 2026 16:25
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-4 branch 2 times, most recently from 35428a1 to cb49f87 Compare June 17, 2026 16:42
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-3 branch from c1d07f0 to 9f27795 Compare June 17, 2026 16:42
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-4 branch from cb49f87 to a46bd24 Compare June 17, 2026 17:32
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-3 branch 2 times, most recently from 2143cd2 to b64184b Compare June 17, 2026 19:05
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-4 branch from a46bd24 to 271e6c5 Compare June 17, 2026 19:05
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-3 branch from b64184b to b06ce94 Compare June 17, 2026 19:17
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-4 branch 2 times, most recently from 6e1c859 to ba97a4a Compare June 18, 2026 06:15
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-3 branch from 540a296 to b6d2dbf Compare June 18, 2026 06:33
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-4 branch 2 times, most recently from edba198 to 3108912 Compare June 18, 2026 07:08
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-3 branch from b6d2dbf to 0606cc5 Compare June 18, 2026 07:08
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-4 branch from 3108912 to d1e0364 Compare June 18, 2026 13:22
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-3 branch from 0606cc5 to 0a2c62c Compare June 18, 2026 13:22
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-4 branch from d1e0364 to b822c2a Compare June 18, 2026 13:36
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-3 branch from 0a2c62c to 20aa56e Compare June 18, 2026 13:36
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-4 branch from b822c2a to fe89d63 Compare June 18, 2026 16:39
@yyforyongyu yyforyongyu force-pushed the impl-runtime-store-3 branch from 20aa56e to c8fe745 Compare June 18, 2026 16:39
@yyforyongyu

Copy link
Copy Markdown
Collaborator Author

No issues found by gpt-5.5 xhigh

@yyforyongyu

Copy link
Copy Markdown
Collaborator Author

No issues found by gpt-5.5 🐞

Comment thread wallet/syncer_test.go Outdated
@yyforyongyu

Copy link
Copy Markdown
Collaborator Author

No issues found by claude-opus-4-8[1m] 🧱

@yyforyongyu

Copy link
Copy Markdown
Collaborator Author

No issues found by claude-opus-4-8[1m] ↩️

@yyforyongyu

Copy link
Copy Markdown
Collaborator Author

No issues found by gpt-5.5 🦜

Comment thread wallet/syncer.go
@yyforyongyu

Copy link
Copy Markdown
Collaborator Author

No issues found by claude-opus-4-8[1m] 🔍

@yyforyongyu

Copy link
Copy Markdown
Collaborator Author

No issues found by claude-opus-4-8[1m] 🧹

@yyforyongyu

Copy link
Copy Markdown
Collaborator Author

No issues found by claude-opus-4-8[1m] 🔭

@yyforyongyu

Copy link
Copy Markdown
Collaborator Author

No issues found by gpt-5.5 🪶

@yyforyongyu

Copy link
Copy Markdown
Collaborator Author

No issues found by claude-opus-4-8[1m] 🔭

@yyforyongyu

Copy link
Copy Markdown
Collaborator Author

No issues found by gpt-5.5 🐌

@yyforyongyu

Copy link
Copy Markdown
Collaborator Author

No issues found by claude-opus-4-8[1m] 🔭

@yyforyongyu

Copy link
Copy Markdown
Collaborator Author

No issues found by gpt-5.5 🦇

Persist filtered-block notification batches through db.Store so
transaction updates and sync-tip advancement stay atomic at the
store boundary.
Assert connected-block notifications write one transaction batch
together with the matching sync-tip update through the Store.
Cover that a bare-multisig output owned through a member pubkey
survives the Store batch path instead of being dropped.
Cover that a relevant transaction carrying both a wallet-owned and
an unrelated third-party output credits only the owned output.
Add the helpers that convert recovery scan results into Store batch
params: horizon merging, horizon flattening, per-output tx params,
and the scan-result block shape.
Write recovery scan batches through db.Store so rescans persist
tx notifications, horizons, and synced blocks through one store
operation.
Route targeted recovery scan results through the Store batch API
without advancing the wallet's synced blocks.
Read the synced tip through syncedTip so checkRollback,
advanceChainSync, and scanWithRewind use the Store's tip rather than
the legacy addrStore tip in store-backed mode.
scanHorizonParams emitted db.ScanHorizon with an empty AccountName, so
ApplyScanBatch fell back to numeric account resolution. That is unsafe
for imported and imported-xpub accounts, whose Store-facing numbers are
masked to 0 and collide with the default derived account.

Thread the *RecoveryState into storeScanBatchParams and stamp every
emitted horizon with the durable account name resolved from the recovery
state, keeping the numeric fallback only for unexpected missing names.
Add coverage proving a confirmed chain.RelevantTx notification builds an
ApplyTxBatch whose transaction carries the confirming block while
SyncedTo stays nil, so the standalone notification records the confirmed
tx without advancing the wallet sync tip.
Add store-backed reads for recovery scan account horizons: ListAccounts
for full scans and GetAccount for targeted scans, converting store
account metadata into RecoveryState horizon shape. Every imported
account is withheld from the horizons, since its number is masked to 0
and would collide with the default derived account in the by-number
recovery lookahead. The wiring of these readers into the scan-state
loader follows in a later commit.
Cover storeScanHorizons over both the full-scan ListAccounts path and
the targeted GetAccount path, including that imported accounts are
withheld from the emitted recovery horizons.
Add store-backed loading of active recovery scan addresses through
paginated ListAddresses queries, extracting one address per stored
script.
Add store-backed loading of UTXOs that recovery scans should watch
through ListOutputsToWatch, converting each store UTXO row into the
recovery scan credit shape.
Aggregate store-backed horizon, address, and watch-output reads into
loadStoreScanData and route wallet and targeted scan-data loading
through the store when store wiring is available.
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.

3 participants