From bcfab4b1b5e14897d4f6279d76e6a6b8764ccea6 Mon Sep 17 00:00:00 2001 From: Arik Sosman Date: Wed, 25 Sep 2024 11:16:55 +0900 Subject: [PATCH] WIP: experimentation stuff --- lightning/src/ln/onion_utils.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lightning/src/ln/onion_utils.rs b/lightning/src/ln/onion_utils.rs index 2d3f560e1f1..65a35b0fe8f 100644 --- a/lightning/src/ln/onion_utils.rs +++ b/lightning/src/ln/onion_utils.rs @@ -560,10 +560,9 @@ pub(super) fn construct_trampoline_onion_packet( .map(|p| { let mut payload_len = LengthCalculatingWriter(0); p.write(&mut payload_len).expect("Failed to calculate length"); - payload_len.0.checked_add(32).expect("Excessive payload size") + payload_len.0.checked_add(32) }) - .try_fold(0usize, |a, b| a.checked_add(b)) - .expect("Excessive onion length"); + .try_fold(0usize, |a, b| b.map(|b| b.checked_add(a))); assert!( minimum_packet_length < ONION_DATA_LEN,