Skip to content

Commit ebe3559

Browse files
committed
review: Explicitly set version in Act creation
Don't rely on the initialized buffer filled with zeros.
1 parent 82f6726 commit ebe3559

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lightning/src/ln/peers/handshake/states.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ impl IHandshakeState for InitiatorAwaitingActTwoState {
313313
let conduit = Conduit::new(sending_key, receiving_key, chaining_key);
314314

315315
// 8. Send m = 0 || c || t
316+
act_three[0] = 0;
316317
Ok((
317318
Some(Act::Three(act_three)),
318319
HandshakeState::Complete(Some((conduit, responder_static_public_key)))
@@ -446,6 +447,7 @@ fn calculate_act_message(local_private_ephemeral_key: &SecretKey, local_public_e
446447
let hash = concat_then_sha256!(hash, &act_out[34..]);
447448

448449
// Send m = 0 || e.pub.serializeCompressed() || c
450+
act_out[0] = 0;
449451
act_out[1..34].copy_from_slice(&serialized_local_public_key);
450452

451453
(hash, chaining_key, temporary_key)

0 commit comments

Comments
 (0)