Add BOLT channel_reestablish (type 136) codec support#50
Add BOLT channel_reestablish (type 136) codec support#50theAnuragMishra wants to merge 1 commit into
Conversation
ekzyis
left a comment
There was a problem hiding this comment.
Hello and welcome! Thank you for the PR.
Noticed two things:
-
Trailing bytes should be decoded as a TLV stream
-
CI didn't run yet, but it would fail. You can run the commands locally before requesting the next review, see .github/workflows/rust.yml.
Related to this, I think we should add #[allow(clippy::too_many_lines)] to fn message_type_values():
$ cargo clippy --all-targets --all-features -- -D warnings
...
error: this function has too many lines (112/100)
--> smite/src/bolt.rs:671:5
|
671 | fn message_type_values() {
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
= note: `-D clippy::too-many-lines` implied by `-D clippy::pedantic`
= help: to override `-D clippy::pedantic` add `#[allow(clippy::too_many_lines)]`
error: could not compile `smite` (lib test) due to 1 previous error
diff --git a/smite/src/bolt.rs b/smite/src/bolt.rs
index c261a1d..b7e2aa9 100644
--- a/smite/src/bolt.rs
+++ b/smite/src/bolt.rs
@@ -668,6 +668,7 @@ mod tests {
}
#[test]
+ #[allow(clippy::too_many_lines)]
fn message_type_values() {
assert_eq!(
Message::Warning(Warning::all_channels("")).msg_type(),| pub struct ChannelReestablish { | ||
| /// The channel ID. | ||
| pub channel_id: ChannelId, | ||
| /// The next commitment number expected from the peer. | ||
| pub next_commitment_number: u64, | ||
| /// The next revocation number expected from the peer. | ||
| pub next_revocation_number: u64, | ||
| /// The sender's view of the receiver's last per-commitment secret. | ||
| pub your_last_per_commitment_secret: [u8; PER_COMMITMENT_SECRET_SIZE], | ||
| /// The sender's current per-commitment point. | ||
| pub my_current_per_commitment_point: PublicKey, | ||
| } |
I do that here in PR #38. I thought of creating a separate PR for it but it seemed like a related change. |
|
Thank you so much for the review guys. Addressing everything in some time |
049bf9f to
9503029
Compare
|
I have addressed all of your points @ekzyis and @Chand-ra . Thank you so much for your reviews. Also ran all the checks in the ci locally, everything is clean. |
This PR adds support for the BOLT 2 channel_reestablish message, which is needed for reconnect/state resynchronization flows.
I have run the tests and it's all green.
part of #5