Codec for BOLT-07 gossip routing#25
Conversation
|
@morehouse In this PR, I tried to implement the codecs for Gossip Protocols and node discovery(Bolt-07). I am now planning to move further with reading and understanding more about gossip protocol and work on the "Gossip message fuzzing" project. |
There was a problem hiding this comment.
Please split this into three PRs: one per codec.
Please also make sure CI passes before requesting another review. You should be able to run all the CI commands locally (e.g., cargo test, cargo fmt, cargo clippy --all-targets --all-features -- -D warnings)
| #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] | ||
| pub struct ChainHash(pub [u8; CHAIN_HASH_SIZE]); | ||
|
|
||
| impl ChainHash { |
There was a problem hiding this comment.
I think we can just continue using [u8; CHAIN_HASH_SIZE] for simplicity -- no need for this newtype.
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
| pub struct Signature(pub [u8; SIGNATURE_SIZE]); | ||
|
|
||
| impl Signature { |
There was a problem hiding this comment.
We already are using secp256k1::ecdsa::Signature elsewhere, so I think we don't need to implement our own signature.
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
| pub struct NodeId(pub [u8; NODE_ID_SIZE]); | ||
|
|
||
| impl NodeId { |
There was a problem hiding this comment.
We already use secp256k1::PublicKey for this elsewhere, so let's not implement our own.
| #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] | ||
| pub struct ShortChannelId(pub u64); | ||
|
|
||
| impl ShortChannelId { |
There was a problem hiding this comment.
Let's just use u64 for simplicity?
Key objectives achieved:
Files changed/added:
smite/src/bolt/wire.rs,smite/src/bolt/types.rs,smite/src/bolt.rsfor wiring up new codecs