-
Notifications
You must be signed in to change notification settings - Fork 338
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
Temporary PR: Evicted at #1839
Draft
evanlinjin
wants to merge
8
commits into
bitcoindevkit:master
Choose a base branch
from
evanlinjin:evicted_at
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
Temporary PR: Evicted at #1839
+768
−330
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
In electrum, heights returned alongside txs may be 0 or -1. 0 means the tx is unconfirmed. -1 means the tx is unconfirmed and spends an unconfirmed tx. Previously, the codebase assumed that heights cannot be negative and used a `i32 as usize` cast (which would lead to panic if the i32 is negative).
Is an spk history contains a tx that spends another unconfirmed tx, the Electrum API will return the tx with a negative height. This should succeed and not panic.
This may, if we introduce new fields to `TxUdpate`, they can be minor non-breaking updates.
* Change `TxUpdate::seen_ats` to be a `HashSet<(Txid, u64)>` so we can introduce multiple timestamps per tx. This is useful to introduce both `first_seen` and `last_seen` timestamps to `TxGraph`. This is also a better API for chain-sources as they can just insert timestamps into the field without checking previous values. * Change sync/full-scan flow to have the request structure introduce the sync time instead of introducing the timestamp when apply the `TxUpdate`. This simplifies the `apply_update{_at}` logic and makes `evicted_at` easier to reason about (in the future).
This is a set of evicted txs from the mempool.
6b92c8f
to
b2b6298
Compare
The evicted-at and last-evicted timestamp informs the `TxGraph` when the transaction was last deemed as missing (evicted) from the mempool. The canonicalization algorithm is changed to disregard transactions with a last-evicted timestamp greater or equal to it's last-seen timestamp. The exception is when we have a canonical descendant due to rules of transitivity. Update rusqlite_impl to persist `last_evicted`. Also update docs: * Remove duplicate paragraphs about `ChangeSet`s. * Add "Canonicalization" section which expands on methods that require canonicalization and the associated data types used in the canonicalization algorithm.
The spk history returned from Electrum should have these txs present. Any missing tx will be considered evicted from the mempool.
b2b6298
to
5e6fcd7
Compare
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.
Description
This is here to make sure CI passes. These changes will be force-pushed to #1811 eventually.
Notes to the reviewers
Changelog notice
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features:
Bugfixes: