Skip to content

smite: Implement update_fail_malformed_htlc codec#38

Merged
morehouse merged 2 commits into
morehouse:masterfrom
Chand-ra:fail_malformed
Apr 22, 2026
Merged

smite: Implement update_fail_malformed_htlc codec#38
morehouse merged 2 commits into
morehouse:masterfrom
Chand-ra:fail_malformed

Conversation

@Chand-ra
Copy link
Copy Markdown

@Chand-ra Chand-ra commented Apr 6, 2026

PRs #27 and #33 cover adding, fulfilling, and failing HTLCs during commitment transaction updates, but the specific "malformed" case is missing. Add the codec for it.

Comment thread smite/src/bolt/update_fail_malformed_htlc.rs
@Vineet1101
Copy link
Copy Markdown

hey @Chand-ra some nit pick comments from my side otherwise your PR LGTM

@Chand-ra
Copy link
Copy Markdown
Author

Chand-ra commented Apr 7, 2026

Thanks @Vineet1101, but I cannot see your comments.

Comment thread smite/src/bolt/update_fail_malformed_htlc.rs Outdated
Comment thread smite/src/bolt/update_fail_malformed_htlc.rs Outdated
Comment thread smite/src/bolt/update_fail_malformed_htlc.rs
@morehouse
Copy link
Copy Markdown
Owner

Also please make sure CI passes before requesting the next review. You should be able to run all the necessary commands locally.

Comment thread smite/src/bolt/update_fail_malformed_htlc.rs Outdated
Comment thread smite/src/bolt/update_fail_malformed_htlc.rs Outdated
Comment thread smite/src/bolt/update_fail_malformed_htlc.rs Outdated
Comment thread smite/src/bolt/update_fail_malformed_htlc.rs Outdated
Comment thread smite/src/bolt/update_fail_malformed_htlc.rs Outdated
@Chand-ra Chand-ra force-pushed the fail_malformed branch 2 times, most recently from 66dc022 to da5bf58 Compare April 11, 2026 19:50
@Chand-ra
Copy link
Copy Markdown
Author

Rebased on top of the latest master to resolve a merge conflict.

Copy link
Copy Markdown
Contributor

@ekzyis ekzyis left a comment

Choose a reason for hiding this comment

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

LGTM, just a few nits, but we could also fix not using the constants everywhere in one PR, like here and new cases where we could use SHA256_HASH_SIZE

Comment thread smite/src/bolt/update_fail_malformed_htlc.rs Outdated
Comment thread smite/src/bolt/update_fail_malformed_htlc.rs Outdated
Comment thread smite/src/bolt.rs Outdated
Comment thread smite/src/bolt.rs Outdated
Comment thread smite/src/bolt.rs
msg_type::UPDATE_FAIL_MALFORMED_HTLC
);
assert_eq!(
Message::GossipTimestampFilter(GossipTimestampFilter::no_gossip([0u8; 32])).msg_type(),
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.

huh looks like I didn't use CHAIN_HASH_SIZE myself here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Maybe it's worth it to replace usage of CHAIN_HASH_SIZE with SHA256_HASH_SIZE, since they're essentially the same thing?

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.

I was thinking about that too. But wouldn't this also apply to TXID_SIZE and CHANNEL_ID_SIZE? A txid is also just a sha256 hash, and a channel id is a txid XOR output index.

Comment thread smite/src/bolt/update_fail_malformed_htlc.rs Outdated
@Chand-ra
Copy link
Copy Markdown
Author

LGTM, just a few nits, but we could also fix not using the constants everywhere in one PR, like here and new cases where we could use SHA256_HASH_SIZE

I think it makes sense to at least use the constant in the new code we're introducing with this PR. As for the other instances, I agree, it makes more sense to fix them in follow-up PR.

Comment thread smite/src/bolt.rs
Comment thread smite/src/bolt/update_fail_malformed_htlc.rs Outdated
@Chand-ra Chand-ra force-pushed the fail_malformed branch 2 times, most recently from cdabb3e to c5a49b5 Compare April 16, 2026 05:22
Comment thread smite/src/bolt/update_fail_malformed_htlc.rs Outdated
Copy link
Copy Markdown
Owner

@morehouse morehouse left a comment

Choose a reason for hiding this comment

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

LGTM

@morehouse morehouse merged commit ea6026c into morehouse:master Apr 22, 2026
1 check 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.

4 participants