refactor(chain): add CanonicalView topological ordering#2219
Open
oleonardolima wants to merge 1 commit into
Open
refactor(chain): add CanonicalView topological ordering#2219oleonardolima wants to merge 1 commit into
CanonicalView topological ordering#2219oleonardolima wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2219 +/- ##
==========================================
+ Coverage 78.65% 78.76% +0.10%
==========================================
Files 30 30
Lines 5909 5938 +29
Branches 279 283 +4
==========================================
+ Hits 4648 4677 +29
Misses 1185 1185
Partials 76 76
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3fa1da6 to
27b4acf
Compare
- add `sort_topologically` to `CanonicalViewTask::finish()` using Kahn's algorithm, ensuring `CanonicalView` returns `Txid`s in topological order (parents before children) - add `test_list_ordered_canonical_txs` with scenarios covering various transaction graph shapes
27b4acf to
88b7de2
Compare
Collaborator
Author
|
@nymius As a heads up I also tested with your tests: nymius@bafd2c9 and nymius@b13a540 and it worked as expected. |
evanlinjin
reviewed
Jun 15, 2026
| #[derive(Debug)] | ||
| pub struct Canonical<A, P> { | ||
| /// List of canonical transaction IDs. | ||
| /// Ordered list of transaction IDs in topological-spending order. |
Member
There was a problem hiding this comment.
This is only true for CanonicalView right? In CanonicalTxs, it's just ordered by the order that the txs got canonicalized.
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.
depends on #2038
closes #2201
Description
Add topological ordering to
CanonicalViewso that parent transactions always appear before their children when iterating canonical transactions. Uses Kahn's algorithm inCanonicalViewTask::finish().Notes to the reviewers
sort_topologicallyis a standalone function incanonical_view_task.rsthat operates over the existingspendsmap, no new data structures needed.HashMapiteration order).Changelog notice
Checklists
All Submissions:
New Features: