Skip to content

staticaddr/deposit: preserve confirmation heights - #1219

Open
hieblmi wants to merge 1 commit into
lightninglabs:masterfrom
hieblmi:fix/static-deposit-confirmation-height
Open

staticaddr/deposit: preserve confirmation heights#1219
hieblmi wants to merge 1 commit into
lightninglabs:masterfrom
hieblmi:fix/static-deposit-confirmation-height

Conversation

@hieblmi

@hieblmi hieblmi commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Static Address deposit reconciliation previously combined queued block epochs with wallet confirmation counts from a different lnd sync point. During rapid lnd catch-up this repeatedly rewrote the persisted first-confirmation height and could make expiry appear eligible one block early.

This change brackets each wallet UTXO query with matching, chain-synced lnd tip observations before deriving absolute confirmation heights. It also:

  • compares tip height and block hash to reject reorg races;
  • defers confirmed-height, expiry, and spending decisions while no authoritative snapshot is available;
  • caps queued expiry notifications at the reconciled tip; and
  • continues tracking genuinely unconfirmed deposits without storing confirmed deposits as unconfirmed.

Stack order (bottom to top / merge order):

  1. staticaddr/deposit: preserve confirmation heights #1219 (9c145058) — confirmation-height preservation (this PR), based on master.
  2. staticaddr: support multiple receive and change addresses #1218 (c74ac6cd) — multi-address core, stacked on this PR.
  3. staticaddr/withdraw: harden replacement monitoring #1215 (8ab455f9) — withdrawal hardening, stacked on staticaddr: support multiple receive and change addresses #1218.

Testing:

  • go test ./staticaddr/...
  • go test -race ./staticaddr/deposit
  • go test ./loopd -run ^$
  • go vet ./staticaddr/deposit ./loopd
  • git diff --check

@hieblmi hieblmi self-assigned this Aug 31, 2026
@hieblmi
hieblmi force-pushed the fix/static-deposit-confirmation-height branch from 577bc1c to 053004f Compare August 31, 2026 10:16
Bracket wallet UTXO queries with matching chain-synced lnd tips
before converting confirmation counts into absolute heights.

Defer expiry and spending decisions while the wallet is catching up,
and cap queued expiry notifications at the reconciled tip.
@hieblmi
hieblmi force-pushed the fix/static-deposit-confirmation-height branch from 053004f to 9c14505 Compare August 31, 2026 10:37
@hieblmi
hieblmi requested a review from starius August 31, 2026 12:31
@hieblmi

hieblmi commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

/gateway review

@lightninglabs-gateway

Copy link
Copy Markdown

👀 gateway review starting…

@hieblmi

hieblmi commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

/gateway re-review

@lightninglabs-gateway

Copy link
Copy Markdown

gateway is not active on this PR. Run /gateway review first to engage it.

@hieblmi

hieblmi commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

/gateway review

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.

1 participant