Skip to content

Commit d4fa36b

Browse files
committed
Also encode chan. upd. prefix in decode_update_add_htlc_onion
1 parent 904fd81 commit d4fa36b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,7 +2243,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
22432243
break None;
22442244
}
22452245
{
2246-
let mut res = VecWriter(Vec::with_capacity(chan_update.serialized_length() + 8 + 2));
2246+
let mut res = VecWriter(Vec::with_capacity(chan_update.serialized_length() + 2 + 8 + 2));
22472247
if let Some(chan_update) = chan_update {
22482248
if code == 0x1000 | 11 || code == 0x1000 | 12 {
22492249
msg.amount_msat.write(&mut res).expect("Writes cannot fail");
@@ -2255,7 +2255,8 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
22552255
// TODO: underspecified, follow https://github.com/lightningnetwork/lightning-rfc/issues/791
22562256
0u16.write(&mut res).expect("Writes cannot fail");
22572257
}
2258-
(chan_update.serialized_length() as u16).write(&mut res).expect("Writes cannot fail");
2258+
(chan_update.serialized_length() as u16 + 2).write(&mut res).expect("Writes cannot fail");
2259+
msgs::ChannelUpdate::TYPE.write(&mut res).expect("Writes cannot fail");
22592260
chan_update.write(&mut res).expect("Writes cannot fail");
22602261
}
22612262
return_err!(err, code, &res.0[..]);
@@ -3547,8 +3548,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
35473548
0u16.write(&mut enc).expect("Writes cannot fail");
35483549
}
35493550
(upd.serialized_length() as u16 + 2).write(&mut enc).expect("Writes cannot fail");
3550-
let chan_update_type = msgs::ChannelUpdate::TYPE;
3551-
chan_update_type.write(&mut enc).expect("Writes cannot fail");
3551+
msgs::ChannelUpdate::TYPE.write(&mut enc).expect("Writes cannot fail");
35523552
upd.write(&mut enc).expect("Writes cannot fail");
35533553
(desired_err_code, enc.0)
35543554
} else {

0 commit comments

Comments
 (0)