Skip to content

Commit 847b6f3

Browse files
committed
Also encode chan. upd. prefix in decode_update_add_htlc_onion
1 parent 310a903 commit 847b6f3

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
@@ -2250,7 +2250,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
22502250
break None;
22512251
}
22522252
{
2253-
let mut res = VecWriter(Vec::with_capacity(chan_update.serialized_length() + 8 + 2));
2253+
let mut res = VecWriter(Vec::with_capacity(chan_update.serialized_length() + 2 + 8 + 2));
22542254
if let Some(chan_update) = chan_update {
22552255
if code == 0x1000 | 11 || code == 0x1000 | 12 {
22562256
msg.amount_msat.write(&mut res).expect("Writes cannot fail");
@@ -2262,7 +2262,8 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
22622262
// TODO: underspecified, follow https://github.com/lightningnetwork/lightning-rfc/issues/791
22632263
0u16.write(&mut res).expect("Writes cannot fail");
22642264
}
2265-
(chan_update.serialized_length() as u16).write(&mut res).expect("Writes cannot fail");
2265+
(chan_update.serialized_length() as u16 + 2).write(&mut res).expect("Writes cannot fail");
2266+
msgs::ChannelUpdate::TYPE.write(&mut res).expect("Writes cannot fail");
22662267
chan_update.write(&mut res).expect("Writes cannot fail");
22672268
}
22682269
return_err!(err, code, &res.0[..]);
@@ -3550,8 +3551,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
35503551
0u16.write(&mut enc).expect("Writes cannot fail");
35513552
}
35523553
(upd.serialized_length() as u16 + 2).write(&mut enc).expect("Writes cannot fail");
3553-
let chan_update_type = msgs::ChannelUpdate::TYPE;
3554-
chan_update_type.write(&mut enc).expect("Writes cannot fail");
3554+
msgs::ChannelUpdate::TYPE.write(&mut enc).expect("Writes cannot fail");
35553555
upd.write(&mut enc).expect("Writes cannot fail");
35563556
(desired_err_code, enc.0)
35573557
} else {

0 commit comments

Comments
 (0)