-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce missing-at
/last-missing
timestamps
#1811
Draft
evanlinjin
wants to merge
11
commits into
bitcoindevkit:master
Choose a base branch
from
evanlinjin:missing_marker
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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
This may, if we introduce new fields to `TxUdpate`, they can be minor non-breaking updates.
evanlinjin
force-pushed
the
missing_marker
branch
from
January 24, 2025 09:03
287b146
to
fe09eab
Compare
evanlinjin
changed the title
Introduce
Introduce Jan 24, 2025
MissingMarker
missing-at
/last-missing
timestamps
LagginTimes
force-pushed
the
missing_marker
branch
from
January 24, 2025 10:58
7f09b70
to
49a64ba
Compare
This is a set of txids missing from the mempool.
The missing-at and last-missing timestamp informs the `TxGraph` when the transaction was last deemed as missing from the mempool (evicted). The canonicalization algorithm is changed to disregard transactions with a last-missing timestamp greater or equal to it's last-seen timestamp. The exception is when we have a canonical descendant due to rules of transitivity.
This is for conveniently adding associations of txid <-> spk. We expect that these txids exist in the spk history. Otherwise, it means the tx is evicted from the mempool and we need to update the `missing_at` value in the sync response.
This is a convenience method for adding unconfirmed txs alongside their associated spks the the sync request. This way, we will be able to detect evictions of these transactions from the mempool.
LagginTimes
force-pushed
the
missing_marker
branch
from
January 24, 2025 15:27
0f52ead
to
2e31bc7
Compare
Looks like only breaking changes are on |
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.
Fixes #1740.
Description
This PR replaces #1765. For context and the original discussion that led to this change, please refer to this comment.
This PR addresses a potential malicious double-spending issue by introducing improvements to unconfirmed transaction tracking. Key changes include the addition of
TxUpdate::missing
that tracks transactions that have been replaced and are no longer in the mempool, and the inclusion oflast_missing
andmissing_at
timestamps inTxGraph
to track when a transaction was last deemed missing.SpkWithHistory
is introduced inSpkClient
to track expectedTxid
s for eachspk
. During a sync, if anyTxid
s fromSpkWithHistory
are not in the current history of anspk
obtained from the chain source, thoseTxid
s are considered missing. Support forSpkWithHistory
has been added to bothbdk_electrum
andbdk_esplora
chain source crates.The canonicalization algorithm is updated to disregard transactions with a
last_missing
timestamp greater than or equal to theirlast_seen
timestamp, except in cases where transitivity rules apply.Changelog notice
TxUpdate::missing
tracks transactions that have been replaced and are no longer present in mempool.last_missing
andmissing_at
timestamps inTxGraph
track when a transaction was last marked as missing from the mempool.last_missing
timestamp greater than or equal to it'slast_seen
timestamp, except when a canonical descendant exists due to rules of transitivity.SpkWithHistory
inSpkClient
keeps track of expectedTxid
s for eachspk
.SpkWithHistory
support added forbdk_electrum
andbdk_esplora
.SyncRequestBuilder::expected_txs
adds an association betweenTxid
andspk
.SyncRequestExt::check_unconfirmed_statuses
adds unconfirmed transactions alongside theirspk
s during sync.Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features:
Bugfixes: