Skip to content

Commit 4a86d91

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 9d8a82b commit 4a86d91

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
@@ -2124,6 +2124,10 @@ impl HTLCFailReason {
21242124
let mut err = err.clone();
21252125
let hold_time = hold_time.unwrap_or(0);
21262126

2127+
if let Some(secondary_shared_secret) = secondary_shared_secret {
2128+
process_failure_packet(&mut err, secondary_shared_secret, hold_time);
2129+
crypt_failure_packet(secondary_shared_secret, &mut err);
2130+
}
21272131
process_failure_packet(&mut err, incoming_packet_shared_secret, hold_time);
21282132
crypt_failure_packet(incoming_packet_shared_secret, &mut err);
21292133

0 commit comments

Comments
 (0)