Skip to content

Conversation

@tankyleo
Copy link
Contributor

Implementations MUST NOT assume any topological order on the transactions.

While Bitcoin Core v29+ submitpackage RPC allows packages of length 1 to be submitted via submitpackage, it still requires all packages submitted there to be child-with-parents.

So we remove the possibility that a batch of transactions passed to a BroadcasterInterface implementation contains unrelated transactions, or multiple children.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Oct 24, 2025

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@tankyleo tankyleo requested a review from TheBlueMatt October 24, 2025 18:52
@codecov
Copy link

codecov bot commented Oct 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.82%. Comparing base (0eec30a) to head (7c9b21f).
⚠️ Report is 28 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4173      +/-   ##
==========================================
+ Coverage   88.78%   88.82%   +0.03%     
==========================================
  Files         180      180              
  Lines      137066   137278     +212     
  Branches   137066   137278     +212     
==========================================
+ Hits       121694   121936     +242     
+ Misses      12552    12531      -21     
+ Partials     2820     2811       -9     
Flag Coverage Δ
fuzzing 21.49% <0.00%> (-0.08%) ⬇️
tests 88.66% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tnull tnull self-requested a review October 24, 2025 19:15
/// package and broadcast together. Some of the transactions may or may not depend on each other,
/// be sure to manage both cases correctly.
/// If more than one transaction is given, these transactions MUST be considered to be a
/// child-with-parents package and be broadcast together. Implementations MUST NOT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: might be worth clarifying a single child and linking the Bitcoin Core docs (if they're online or just saying "the submitpackage RPC").

@tankyleo tankyleo force-pushed the 25-10-broadcaster-docs branch from 4ba0e53 to 5916b2a Compare October 24, 2025 23:13
Comment on lines 39 to 40
/// If more than one transaction is given, these transactions MUST be considered to be a
/// single-child-with-parents package and be broadcast together
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// If more than one transaction is given, these transactions MUST be considered to be a
/// single-child-with-parents package and be broadcast together
/// If more than one transaction is given, these transactions MUST be a
/// single child and its parents and be broadcast together as a package

@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@tankyleo tankyleo force-pushed the 25-10-broadcaster-docs branch from 5916b2a to aac2b29 Compare October 27, 2025 05:40
/// single child and its parents and be broadcast together as a package
/// (see the `submitpackage` Bitcoin Core RPC).
///
/// Implementations MUST NOT assume any topological order on the transactions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in submitpackage's docs it says

The package must be topologically sorted, with the child being the last element in the array.

making the user handle this seems like extra complexity that LDK should be able to handle for them

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LDK will still broadcast transactions topologically (and maybe we should check that in the tests @tankyleo) but the API is also sometimes used by dowstream code (eg ldk-node) and it seems like a good thing for the BroadcasterInterface implementation to re-sort topologically.

tnull
tnull previously approved these changes Oct 27, 2025
Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM, one comment.

So we remove the possibility that a batch of transactions passed to a BroadcasterInterface implementation contains unrelated transactions, or multiple children.

Good, that possibly makes things a bit easier down the line also, when add a BroadcastType or similar to the BroadcasterInterface. (Will see to open a draft for this soonish)

/// be sure to manage both cases correctly.
/// If more than one transaction is given, these transactions MUST be a
/// single child and its parents and be broadcast together as a package
/// (see the `submitpackage` Bitcoin Core RPC).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a link here, especially since Core docs for RPCs aren't super discoverable?

Implementations MUST NOT assume any topological order on the
transactions.

While Bitcoin Core v29+ `submitpackage` RPC allows packages of length 1
to be submitted via `submitpackage`, it still requires any package
submitted there to be a `child-with-parents` package.

So we remove the possibility that a batch of transactions passed to
a `BroadcasterInterface` implementation contains unrelated transactions,
or multiple children.
@tankyleo tankyleo force-pushed the 25-10-broadcaster-docs branch from 10a403e to 7c9b21f Compare October 27, 2025 19:45
Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Gonna go ahead and land this since its just doc + test.

@TheBlueMatt TheBlueMatt merged commit fdc8731 into lightningdevkit:main Oct 27, 2025
22 of 25 checks passed
@TheBlueMatt TheBlueMatt mentioned this pull request Oct 29, 2025
@TheBlueMatt
Copy link
Collaborator

Backported to 0.2 in #4185.

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.

5 participants