smite-ir: add LoadShortChannelId operation#96
Open
devvaansh wants to merge 2 commits into
Open
Conversation
Adds wire codecs for the BOLT 7 short_channel_id packed type and the
channel_update gossip message (type 258), including sign/verify helpers
backed by secp256k1 ECDSA, and wires ChannelUpdate into the central
Message enum so it can be dispatched off the wire.
short_channel_id:
* Packed u64 representation per BOLT 7 (3 bytes block || 3 bytes tx ||
2 bytes output). new() panics on out-of-range components (24-bit
block / tx index), which would be a programmer error in every
realistic caller. from_u64 is the infallible inverse of as_u64.
channel_update:
* Preserves any trailing unknown bytes via a pub extra: Vec<u8> field
so that re-encoding is byte-identical and the signature still
verifies. Per BOLT 7 the signature covers everything after the
leading signature field, including unknown fields following
fee_proportional_millionths.
* sign(&mut self, sk) writes the body via write_body (which includes
extra) and stores the resulting ECDSA signature.
* verify(&self, pk) -> bool recomputes the digest and returns whether
the stored signature matches the supplied pubkey. Unlike
node_announcement, channel_update does not embed node_id on the
wire, so the receiver must look the key up from the previously-seen
channel_announcement for short_channel_id and pass it explicitly.
* The decoder is intentionally lenient about flag bits (it preserves
message_flags / channel_flags verbatim) and leaves policy decisions
such as enforcement of must_be_one to the caller -- this matches
how we want to fuzz divergent BOLT 7 implementations.
LoadShortChannelId operation
87513b8 to
259fe5e
Compare
Short channel IDs are needed for BOLT 7 gossip messages such as channel_announcement and channel_update.
259fe5e to
d5605a0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Short channel IDs are needed for BOLT 7 gossip messages such as
channel_announcement and channel_update.
A short channel ID encodes the block height, transaction index, and
output index of the funding transaction as a packed u64.
Part of #71.