Skip to content

smite: add tu32/tu64 truncated integer wire types - #166

Merged
morehouse merged 1 commit into
morehouse:masterfrom
erickcestari:bolt-truncated-integers
Jul 31, 2026
Merged

smite: add tu32/tu64 truncated integer wire types#166
morehouse merged 1 commit into
morehouse:masterfrom
erickcestari:bolt-truncated-integers

Conversation

@erickcestari

Copy link
Copy Markdown
Contributor

This will be needed for BOLT 4 hop payloads, which use tu32 and tu64 to encode fields.

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

Looks good!

Comment thread smite/src/bolt/wire.rs Outdated
Comment thread smite/src/bolt/wire.rs Outdated
Comment thread smite/src/bolt/wire.rs Outdated
@erickcestari

Copy link
Copy Markdown
Contributor Author

Thanks for the review @NishantBansal2003 . I've addressed your nits!

Comment thread smite/src/bolt/wire.rs
Comment thread smite/src/bolt/wire.rs Outdated
@erickcestari
erickcestari force-pushed the bolt-truncated-integers branch from fabeea3 to 3c84efb Compare July 31, 2026 13:55
BOLT 1 truncated integers show up as TLV values in BOLT 4 hop payloads
(amt_to_forward, outgoing_cltv_value, total_msat). They are big-endian
with leading zero bytes stripped, so their width is only recoverable
from the enclosing TLV record: read consumes all remaining bytes, which
makes them usable with TlvStream::get_as but not as a field in the
middle of a message.

Non-minimal encodings and values wider than the integer are rejected.
@erickcestari
erickcestari force-pushed the bolt-truncated-integers branch from 3c84efb to f66eb9f Compare July 31, 2026 14:02
@erickcestari
erickcestari requested a review from morehouse July 31, 2026 14:03

@morehouse morehouse left a 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.

LGTM

@morehouse
morehouse merged commit 0d79abd into morehouse:master Jul 31, 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