Repository navigation
fix(history): count a received silent payment's confirmations from its block - #229
Open
coolstack-coder wants to merge 1 commit into
Open
coolstack-coder wants to merge 1 commit into
coolstack-coder wants to merge 1 commit into
Conversation
…s block
An incoming silent payment was always listed with 7 confirmations. A
payment that had just confirmed read as settled ("6+" in details, no
"1 conf" in the list), and one still in the mempool, found with Track a
payment, read as confirmed rather than pending.
Confirmations now come from the UTXO's height against the scan tip:
0 while the payment is unconfirmed, and at least 1 once it has a block,
even if the scan hasn't reached that block yet. The list row re-renders
when the count changes, so it doesn't stay stuck on the first value.
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.
Problem
getTransactions()lists every received silent payment withconfirmations: 7(// FIXME: dont assume stuff). Two user-visible effects:scanByTxid, height 0), shows as confirmed instead of pending.Fix
lastScannedBlock:0at height 0, otherwisemax(tip - height + 1, 1). The floor covers a payment found byscanByTxidin a block the range scan hasn't reached yet.confirmationsinTransactionListItem's memo, so a row on screen updates as the count rises.Outgoing SP-only spends keep their own count. #183 and #170 already handle those.
Tests
New cases in
tests/unit/bip352.test.tscover the scan tip, the mempool and a block past the scan tip. They fail onmasterand pass here.tscandeslintare clean.sendDetails.test.tsx› "fills in a payment request opened from home" fails onmastertoo, so it's unrelated to this change.