Skip to content

Commit 6f538dc

Browse files
committed
ln: double encrypt errors received from downstream failures
If we're a trampoline node and received an error from downstream that we can't fully decrypt, we want to double-wrap it for the original sender. Previously not implemented because we'd only focused on receives, where there's no possibility of a downstream error. While proper error handling will be added in a followup, we add the bare minimum required here for testing.
1 parent b370a26 commit 6f538dc

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lightning/src/ln/onion_utils.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,6 +2128,10 @@ impl HTLCFailReason {
21282128
let mut err = err.clone();
21292129
let hold_time = hold_time.unwrap_or(0);
21302130

2131+
if let Some(secondary_shared_secret) = secondary_shared_secret {
2132+
process_failure_packet(&mut err, secondary_shared_secret, hold_time);
2133+
crypt_failure_packet(secondary_shared_secret, &mut err);
2134+
}
21312135
process_failure_packet(&mut err, incoming_packet_shared_secret, hold_time);
21322136
crypt_failure_packet(incoming_packet_shared_secret, &mut err);
21332137

0 commit comments

Comments
 (0)