Skip to content

Commit 0819091

Browse files
committed
f make total_msat required
1 parent b20dc48 commit 0819091

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16946,7 +16946,7 @@ impl Readable for (ClaimableHTLC, u64) {
1694616946
fn read<R: Read>(reader: &mut R) -> Result<Self, DecodeError> {
1694716947
_init_and_read_len_prefixed_tlv_fields!(reader, {
1694816948
(0, prev_hop, required),
16949-
(1, total_msat, option),
16949+
(1, total_msat, required), // Added and always written in 0.0.107
1695016950
(2, value_ser, required),
1695116951
(3, sender_intended_value, option),
1695216952
(4, payment_data_opt, option),
@@ -16962,20 +16962,9 @@ impl Readable for (ClaimableHTLC, u64) {
1696216962
if payment_data.is_some() {
1696316963
return Err(DecodeError::InvalidValue)
1696416964
}
16965-
if total_msat.is_none() {
16966-
total_msat = Some(value);
16967-
}
1696816965
OnionPayload::Spontaneous(p)
1696916966
},
16970-
None => {
16971-
if total_msat.is_none() {
16972-
if payment_data.is_none() {
16973-
return Err(DecodeError::InvalidValue)
16974-
}
16975-
total_msat = Some(payment_data.as_ref().unwrap().total_msat);
16976-
}
16977-
OnionPayload::Invoice { _legacy_hop_data: payment_data }
16978-
},
16967+
None => OnionPayload::Invoice { _legacy_hop_data: payment_data },
1697916968
};
1698016969
Ok((ClaimableHTLC {
1698116970
prev_hop: prev_hop.0.unwrap(),
@@ -16986,7 +16975,7 @@ impl Readable for (ClaimableHTLC, u64) {
1698616975
onion_payload,
1698716976
cltv_expiry: cltv_expiry.0.unwrap(),
1698816977
counterparty_skimmed_fee_msat,
16989-
}, total_msat.unwrap()))
16978+
}, total_msat.0.expect("required field")))
1699016979
}
1699116980
}
1699216981

0 commit comments

Comments
 (0)