Skip to content
4 changes: 3 additions & 1 deletion lightning/src/chain/channelmonitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2432,6 +2432,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
None => panic!("Outbound HTLCs should have a source"),
Some(&HTLCSource::PreviousHopData(_)) => false,
Some(&HTLCSource::OutboundRoute { .. }) => true,
Some(&HTLCSource::TrampolineForward { .. }) => false,
};
return Some(Balance::MaybeTimeoutClaimableHTLC {
amount_satoshis: htlc.amount_msat / 1000,
Expand Down Expand Up @@ -2646,6 +2647,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
None => panic!("Outbound HTLCs should have a source"),
Some(HTLCSource::PreviousHopData(_)) => false,
Some(HTLCSource::OutboundRoute { .. }) => true,
Some(HTLCSource::TrampolineForward { .. }) => false,
};
if outbound_payment {
outbound_payment_htlc_rounded_msat += rounded_value_msat;
Expand Down Expand Up @@ -3171,7 +3173,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
} else { false }
}));
}
self.counterparty_fulfilled_htlcs.insert(*claimed_htlc_id, *claimed_preimage);
self.counterparty_fulfilled_htlcs.insert(claimed_htlc_id.clone(), *claimed_preimage);
}
}

Expand Down
12 changes: 12 additions & 0 deletions lightning/src/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,14 @@ pub enum HTLCDestination {
/// Short channel id we are requesting to forward an HTLC to.
requested_forward_scid: u64
},
/// We couldn't forward to the next Trampoline node. That may happen if we cannot find a route,
/// or if the route we found didn't work out
FailedTrampolineForward {
/// The node ID of the next Trampoline hop we tried forwarding to
requested_next_node_id: PublicKey,
/// The channel we tried forwarding over, if we have settled on one
forward_scid: Option<u64>,
},
Comment on lines +493 to +500
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all about to change a lot with #3700 so may want to use an existing variant instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we wait until #3700 lands? Or I can coördinate with Carla? It seems to be the existing variants really don't map nicely, but I won't die on that hill.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it might be a good idea to coordinate with her, I think 3700 should be landing soon.

/// We couldn't decode the incoming onion to obtain the forwarding details.
InvalidOnion,
/// Failure scenario where an HTLC may have been forwarded to be intended for us,
Expand Down Expand Up @@ -523,6 +531,10 @@ impl_writeable_tlv_based_enum_upgradable!(HTLCDestination,
(4, FailedPayment) => {
(0, payment_hash, required),
},
(5, FailedTrampolineForward) => {
(0, requested_next_node_id, required),
(2, forward_scid, option),
},
);

/// Will be used in [`Event::HTLCIntercepted`] to identify the next hop in the HTLC's path.
Expand Down
Loading