Skip to content

smite: refactor commitment transaction construction - #244

Merged
morehouse merged 5 commits into
lnfuzz:masterfrom
NishantBansal2003:refactor-commitment
Sep 11, 2026
Merged

smite: refactor commitment transaction construction#244
morehouse merged 5 commits into
lnfuzz:masterfrom
NishantBansal2003:refactor-commitment

Conversation

@NishantBansal2003

Copy link
Copy Markdown
Contributor

Mostly cherry-picked some refactor commits from #181 to make the diff shorter.

Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Comment thread smite/src/channel_tx/commitment.rs
Comment thread smite/src/channel_tx/commitment.rs
Comment thread smite/src/channel_tx/commitment.rs Outdated
Comment thread smite/src/channel_tx/commitment.rs Outdated
Comment thread smite/src/channel_tx/commitment.rs Outdated
Comment thread smite/src/channel_tx/commitment.rs Outdated
Comment thread smite/src/channel_tx/commitment.rs Outdated
Comment thread smite/src/channel_tx/commitment.rs
Comment thread smite/src/channel_tx/commitment.rs Outdated

@erickcestari erickcestari left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

let local_per_commitment_point = state.party(local_side).per_commitment_point;

let mut outputs: Vec<TxOut> = Vec::new();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Evaluate the dust check once and reuse it for the to_local/to_remote outputs and their anchors.

Suggested change
let has_to_local = to_local_value >= local.dust_limit_satoshis;
let has_to_remote = to_remote_value >= local.dust_limit_satoshis;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done!

@morehouse morehouse left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Adding anchor outputs separately from the to_local and to_remote
outputs prepares for HTLC outputs. Under BOLT 3, an anchor output
is still added when its main output is trimmed as long as there is
an untrimmed HTLC output.

Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
@morehouse
morehouse merged commit 5105057 into lnfuzz:master Sep 11, 2026
5 checks passed
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.

3 participants