Skip to content

Commit 887aec9

Browse files
a-mpcharik-so
andcommitted
Create TrampolineForward HTLCSource variant
To process errors returned from downstream nodes when forwarding between Trampoline nodes, we need to store information beyond what's available in `HTLCPreviousHopData`, suc as the used hops as the newly generated outer onion's session_priv. To that end, we add a new variant to `HTLCSource` in this commit, which futre-proofs mapping an outbound forward to an incoming MPP. Co-authored-by: Arik Sosman <[email protected]>
1 parent 29195fb commit 887aec9

File tree

4 files changed

+449
-176
lines changed

4 files changed

+449
-176
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2626,6 +2626,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
26262626
let outbound_payment = match source {
26272627
None => panic!("Outbound HTLCs should have a source"),
26282628
Some(&HTLCSource::PreviousHopData(_)) => false,
2629+
Some(&HTLCSource::TrampolineForward { .. }) => false,
26292630
Some(&HTLCSource::OutboundRoute { .. }) => true,
26302631
};
26312632
return Some(Balance::MaybeTimeoutClaimableHTLC {
@@ -2835,6 +2836,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
28352836
let outbound_payment = match source {
28362837
None => panic!("Outbound HTLCs should have a source"),
28372838
Some(HTLCSource::PreviousHopData(_)) => false,
2839+
Some(HTLCSource::TrampolineForward { .. }) => false,
28382840
Some(HTLCSource::OutboundRoute { .. }) => true,
28392841
};
28402842
if outbound_payment {
@@ -3494,7 +3496,8 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
34943496
}
34953497
}));
34963498
}
3497-
self.counterparty_fulfilled_htlcs.insert(*claimed_htlc_id, *claimed_preimage);
3499+
let claimed = claimed_htlc_id.clone();
3500+
self.counterparty_fulfilled_htlcs.insert(claimed, *claimed_preimage);
34983501
}
34993502

35003503
Ok(())

0 commit comments

Comments
 (0)