Skip to content

smite: Implement update_fail_malformed_htlc codec#38

Open
Chand-ra wants to merge 1 commit intomorehouse:masterfrom
Chand-ra:fail_malformed
Open

smite: Implement update_fail_malformed_htlc codec#38
Chand-ra wants to merge 1 commit intomorehouse: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.

/// Encodes to wire format (without message type prefix).
#[must_use]
pub fn encode(&self) -> Vec<u8> {
let mut out = Vec::new();
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.

Since we know the message size at compile time, maybe it's better to go with Vec::with_capacity() here instead? The other codecs use Vec::new() so I decided to preserve uniformity, but maybe the former is better?

Copy link
Copy Markdown
Contributor

@ekzyis ekzyis Apr 7, 2026

Choose a reason for hiding this comment

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

Good question, see #37 (comment)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

For consistency, let's keep it the same. Later, if we determine this optimization is worthwhile, we can do it for all codecs in one PR.

@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.

/// Encodes to wire format (without message type prefix).
#[must_use]
pub fn encode(&self) -> Vec<u8> {
let mut out = Vec::new();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

For consistency, let's keep it the same. Later, if we determine this optimization is worthwhile, we can do it for all codecs in one PR.

@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.

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