Skip to content

Commit 9ceb9d6

Browse files
committed
f make total_msat required
1 parent 6eaa047 commit 9ceb9d6

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
@@ -16947,7 +16947,7 @@ impl Readable for (ClaimableHTLC, u64) {
1694716947
fn read<R: Read>(reader: &mut R) -> Result<Self, DecodeError> {
1694816948
_init_and_read_len_prefixed_tlv_fields!(reader, {
1694916949
(0, prev_hop, required),
16950-
(1, total_msat, option),
16950+
(1, total_msat, required), // Added and always written in 0.0.107
1695116951
(2, value_ser, required),
1695216952
(3, sender_intended_value, option),
1695316953
(4, payment_data_opt, option),
@@ -16963,20 +16963,9 @@ impl Readable for (ClaimableHTLC, u64) {
1696316963
if payment_data.is_some() {
1696416964
return Err(DecodeError::InvalidValue)
1696516965
}
16966-
if total_msat.is_none() {
16967-
total_msat = Some(value);
16968-
}
1696916966
OnionPayload::Spontaneous(p)
1697016967
},
16971-
None => {
16972-
if total_msat.is_none() {
16973-
if payment_data.is_none() {
16974-
return Err(DecodeError::InvalidValue)
16975-
}
16976-
total_msat = Some(payment_data.as_ref().unwrap().total_msat);
16977-
}
16978-
OnionPayload::Invoice { _legacy_hop_data: payment_data }
16979-
},
16968+
None => OnionPayload::Invoice { _legacy_hop_data: payment_data },
1698016969
};
1698116970
Ok((ClaimableHTLC {
1698216971
prev_hop: prev_hop.0.unwrap(),
@@ -16987,7 +16976,7 @@ impl Readable for (ClaimableHTLC, u64) {
1698716976
onion_payload,
1698816977
cltv_expiry: cltv_expiry.0.unwrap(),
1698916978
counterparty_skimmed_fee_msat,
16990-
}, total_msat.unwrap()))
16979+
}, total_msat.0.expect("required field")))
1699116980
}
1699216981
}
1699316982

0 commit comments

Comments
 (0)