Skip to content

Commit 694921e

Browse files
committed
Update tests to test re-claiming of forwarded HTLCs on startup
Because some of these tests require connecting blocks without calling `get_and_clear_pending_msg_events`, we need to split up the block connection utilities to only optionally call sanity-checks.
1 parent 4c785b2 commit 694921e

File tree

4 files changed

+246
-43
lines changed

4 files changed

+246
-43
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use crate::sync::{Mutex, LockTestExt};
6767
/// much smaller than a full [`ChannelMonitor`]. However, for large single commitment transaction
6868
/// updates (e.g. ones during which there are hundreds of HTLCs pending on the commitment
6969
/// transaction), a single update may reach upwards of 1 MiB in serialized size.
70-
#[derive(Clone, PartialEq, Eq)]
70+
#[derive(Clone, Debug, PartialEq, Eq)]
7171
#[must_use]
7272
pub struct ChannelMonitorUpdate {
7373
pub(crate) updates: Vec<ChannelMonitorUpdateStep>,
@@ -487,7 +487,7 @@ impl_writeable_tlv_based_enum_upgradable!(OnchainEvent,
487487

488488
);
489489

490-
#[derive(Clone, PartialEq, Eq)]
490+
#[derive(Clone, Debug, PartialEq, Eq)]
491491
pub(crate) enum ChannelMonitorUpdateStep {
492492
LatestHolderCommitmentTXInfo {
493493
commitment_tx: HolderCommitmentTransaction,

lightning/src/ln/chan_utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ pub fn derive_public_revocation_key<T: secp256k1::Verification>(secp_ctx: &Secp2
450450
/// channel basepoints via the new function, or they were obtained via
451451
/// CommitmentTransaction.trust().keys() because we trusted the source of the
452452
/// pre-calculated keys.
453-
#[derive(PartialEq, Eq, Clone)]
453+
#[derive(PartialEq, Eq, Clone, Debug)]
454454
pub struct TxCreationKeys {
455455
/// The broadcaster's per-commitment public key which was used to derive the other keys.
456456
pub per_commitment_point: PublicKey,
@@ -1028,7 +1028,7 @@ impl<'a> DirectedChannelTransactionParameters<'a> {
10281028
/// Information needed to build and sign a holder's commitment transaction.
10291029
///
10301030
/// The transaction is only signed once we are ready to broadcast.
1031-
#[derive(Clone)]
1031+
#[derive(Clone, Debug)]
10321032
pub struct HolderCommitmentTransaction {
10331033
inner: CommitmentTransaction,
10341034
/// Our counterparty's signature for the transaction
@@ -1134,7 +1134,7 @@ impl HolderCommitmentTransaction {
11341134
}
11351135

11361136
/// A pre-built Bitcoin commitment transaction and its txid.
1137-
#[derive(Clone)]
1137+
#[derive(Clone, Debug)]
11381138
pub struct BuiltCommitmentTransaction {
11391139
/// The commitment transaction
11401140
pub transaction: Transaction,
@@ -1305,7 +1305,7 @@ impl<'a> TrustedClosingTransaction<'a> {
13051305
///
13061306
/// This class can be used inside a signer implementation to generate a signature given the relevant
13071307
/// secret key.
1308-
#[derive(Clone)]
1308+
#[derive(Clone, Debug)]
13091309
pub struct CommitmentTransaction {
13101310
commitment_number: u64,
13111311
to_broadcaster_value_sat: u64,

lightning/src/ln/chanmon_update_fail_tests.rs

Lines changed: 237 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3099,7 +3099,7 @@ fn test_blocked_chan_preimage_release() {
30993099
expect_payment_sent(&nodes[2], payment_preimage_2, None, true, true);
31003100
}
31013101

3102-
fn do_test_inverted_mon_completion_order(complete_bc_commitment_dance: bool) {
3102+
fn do_test_inverted_mon_completion_order(with_latest_manager: bool, complete_bc_commitment_dance: bool) {
31033103
// When we forward a payment and receive an `update_fulfill_htlc` message from the downstream
31043104
// channel, we immediately claim the HTLC on the upstream channel, before even doing a
31053105
// `commitment_signed` dance on the downstream channel. This implies that our
@@ -3127,6 +3127,10 @@ fn do_test_inverted_mon_completion_order(complete_bc_commitment_dance: bool) {
31273127
let (payment_preimage, payment_hash, _) = route_payment(&nodes[0], &[&nodes[1], &nodes[2]], 100_000);
31283128

31293129
let mon_ab = get_monitor!(nodes[1], chan_id_ab).encode();
3130+
let mut manager_b = Vec::new();
3131+
if !with_latest_manager {
3132+
manager_b = nodes[1].node.encode();
3133+
}
31303134

31313135
nodes[2].node.claim_funds(payment_preimage);
31323136
check_added_monitors(&nodes[2], 1);
@@ -3163,62 +3167,261 @@ fn do_test_inverted_mon_completion_order(complete_bc_commitment_dance: bool) {
31633167
}
31643168

31653169
// Now reload node B
3166-
let manager_b = nodes[1].node.encode();
3170+
if with_latest_manager {
3171+
manager_b = nodes[1].node.encode();
3172+
}
31673173

31683174
let mon_bc = get_monitor!(nodes[1], chan_id_bc).encode();
31693175
reload_node!(nodes[1], &manager_b, &[&mon_ab, &mon_bc], persister, new_chain_monitor, nodes_1_deserialized);
31703176

31713177
nodes[0].node.peer_disconnected(&nodes[1].node.get_our_node_id());
31723178
nodes[2].node.peer_disconnected(&nodes[1].node.get_our_node_id());
31733179

3174-
// If we used the latest ChannelManager to reload from, we should have both channels still
3175-
// live. The B <-> C channel's final RAA ChannelMonitorUpdate must still be blocked as
3176-
// before - the ChannelMonitorUpdate for the A <-> B channel hasn't completed.
3177-
// When we call `timer_tick_occurred` we will get that monitor update back, which we'll
3178-
// complete after reconnecting to our peers.
3179-
persister.set_update_ret(ChannelMonitorUpdateStatus::InProgress);
3180-
nodes[1].node.timer_tick_occurred();
3181-
check_added_monitors(&nodes[1], 1);
3182-
assert!(nodes[1].node.get_and_clear_pending_msg_events().is_empty());
3180+
if with_latest_manager {
3181+
// If we used the latest ChannelManager to reload from, we should have both channels still
3182+
// live. The B <-> C channel's final RAA ChannelMonitorUpdate must still be blocked as
3183+
// before - the ChannelMonitorUpdate for the A <-> B channel hasn't completed.
3184+
// When we call `timer_tick_occurred` we will get that monitor update back, which we'll
3185+
// complete after reconnecting to our peers.
3186+
persister.set_update_ret(ChannelMonitorUpdateStatus::InProgress);
3187+
nodes[1].node.timer_tick_occurred();
3188+
check_added_monitors(&nodes[1], 1);
3189+
assert!(nodes[1].node.get_and_clear_pending_msg_events().is_empty());
31833190

3184-
// Now reconnect B to both A and C. If the B <-> C commitment signed dance wasn't run to
3185-
// the end go ahead and do that, though the -2 in `reconnect_nodes` indicates that we
3186-
// expect to *not* receive the final RAA ChannelMonitorUpdate.
3187-
if complete_bc_commitment_dance {
3188-
reconnect_nodes(ReconnectArgs::new(&nodes[1], &nodes[2]));
3191+
// Now reconnect B to both A and C. If the B <-> C commitment signed dance wasn't run to
3192+
// the end go ahead and do that, though the -2 in `reconnect_nodes` indicates that we
3193+
// expect to *not* receive the final RAA ChannelMonitorUpdate.
3194+
if complete_bc_commitment_dance {
3195+
reconnect_nodes(ReconnectArgs::new(&nodes[1], &nodes[2]));
3196+
} else {
3197+
let mut reconnect_args = ReconnectArgs::new(&nodes[1], &nodes[2]);
3198+
reconnect_args.pending_responding_commitment_signed.1 = true;
3199+
reconnect_args.pending_responding_commitment_signed_dup_monitor.1 = true;
3200+
reconnect_args.pending_raa = (false, true);
3201+
reconnect_nodes(reconnect_args);
3202+
}
3203+
3204+
reconnect_nodes(ReconnectArgs::new(&nodes[0], &nodes[1]));
3205+
3206+
// (Finally) complete the A <-> B ChannelMonitorUpdate, ensuring the preimage is durably on
3207+
// disk in the proper ChannelMonitor, unblocking the B <-> C ChannelMonitor updating
3208+
// process.
3209+
let (outpoint, _, ab_update_id) = nodes[1].chain_monitor.latest_monitor_update_id.lock().unwrap().get(&chan_id_ab).unwrap().clone();
3210+
nodes[1].chain_monitor.chain_monitor.channel_monitor_updated(outpoint, ab_update_id).unwrap();
3211+
3212+
// When we fetch B's HTLC update messages next (now that the ChannelMonitorUpdate has
3213+
// completed), it will also release the final RAA ChannelMonitorUpdate on the B <-> C
3214+
// channel.
31893215
} else {
3190-
let mut reconnect_args = ReconnectArgs::new(&nodes[1], &nodes[2]);
3191-
reconnect_args.pending_responding_commitment_signed.1 = true;
3192-
reconnect_args.pending_responding_commitment_signed_dup_monitor.1 = true;
3193-
reconnect_args.pending_raa = (false, true);
3194-
reconnect_nodes(reconnect_args);
3195-
}
3216+
// If the ChannelManager used in the reload was stale, check that the B <-> C channel was
3217+
// closed.
3218+
//
3219+
// Note that this will also process the ChannelMonitorUpdates which were queued up when we
3220+
// reloaded the ChannelManager. This will re-emit the A<->B preimage as well as the B<->C
3221+
// force-closure ChannelMonitorUpdate. Once the A<->B preimage update completes, the claim
3222+
// commitment update will be allowed to go out.
3223+
check_added_monitors(&nodes[1], 0);
3224+
persister.set_update_ret(ChannelMonitorUpdateStatus::InProgress);
3225+
persister.set_update_ret(ChannelMonitorUpdateStatus::InProgress);
3226+
check_closed_event(&nodes[1], 1, ClosureReason::OutdatedChannelManager, false, &[nodes[2].node.get_our_node_id()], 100_000);
3227+
check_added_monitors(&nodes[1], 2);
3228+
3229+
nodes[1].node.timer_tick_occurred();
3230+
check_added_monitors(&nodes[1], 0);
31963231

3197-
reconnect_nodes(ReconnectArgs::new(&nodes[0], &nodes[1]));
3232+
// Don't bother to reconnect B to C - that channel has been closed. We don't need to
3233+
// exchange any messages here even though there's a pending commitment update because the
3234+
// ChannelMonitorUpdate hasn't yet completed.
3235+
reconnect_nodes(ReconnectArgs::new(&nodes[0], &nodes[1]));
31983236

3199-
// (Finally) complete the A <-> B ChannelMonitorUpdate, ensuring the preimage is durably on
3200-
// disk in the proper ChannelMonitor, unblocking the B <-> C ChannelMonitor updating
3201-
// process.
3202-
let (outpoint, _, ab_update_id) = nodes[1].chain_monitor.latest_monitor_update_id.lock().unwrap().get(&chan_id_ab).unwrap().clone();
3203-
nodes[1].chain_monitor.chain_monitor.channel_monitor_updated(outpoint, ab_update_id).unwrap();
3237+
let (outpoint, _, ab_update_id) = nodes[1].chain_monitor.latest_monitor_update_id.lock().unwrap().get(&chan_id_ab).unwrap().clone();
3238+
nodes[1].chain_monitor.chain_monitor.channel_monitor_updated(outpoint, ab_update_id).unwrap();
3239+
3240+
// The ChannelMonitorUpdate which was completed prior to the reconnect only contained the
3241+
// preimage (as it was a replay of the original ChannelMonitorUpdate from before we
3242+
// restarted). When we go to fetch the commitment transaction updates we'll poll the
3243+
// ChannelMonitorUpdate completion, then generate (and complete) a new ChannelMonitorUpdate
3244+
// with the actual commitment transaction, which will allow us to fulfill the HTLC with
3245+
// node A.
3246+
}
32043247

3205-
// When we fetch B's HTLC update messages here (now that the ChannelMonitorUpdate has
3206-
// completed), it will also release the final RAA ChannelMonitorUpdate on the B <-> C
3207-
// channel.
32083248
let bs_updates = get_htlc_update_msgs(&nodes[1], &nodes[0].node.get_our_node_id());
32093249
check_added_monitors(&nodes[1], 1);
32103250

32113251
nodes[0].node.handle_update_fulfill_htlc(&nodes[1].node.get_our_node_id(), &bs_updates.update_fulfill_htlcs[0]);
32123252
do_commitment_signed_dance(&nodes[0], &nodes[1], &bs_updates.commitment_signed, false, false);
32133253

3214-
expect_payment_forwarded!(nodes[1], &nodes[0], &nodes[2], Some(1_000), false, false);
3254+
expect_payment_forwarded!(nodes[1], &nodes[0], &nodes[2], Some(1_000), false, !with_latest_manager);
32153255

32163256
// Finally, check that the payment was, ultimately, seen as sent by node A.
32173257
expect_payment_sent(&nodes[0], payment_preimage, None, true, true);
32183258
}
32193259

32203260
#[test]
32213261
fn test_inverted_mon_completion_order() {
3222-
do_test_inverted_mon_completion_order(true);
3223-
do_test_inverted_mon_completion_order(false);
3262+
do_test_inverted_mon_completion_order(true, true);
3263+
do_test_inverted_mon_completion_order(true, false);
3264+
do_test_inverted_mon_completion_order(false, true);
3265+
do_test_inverted_mon_completion_order(false, false);
3266+
}
3267+
3268+
fn do_test_durable_preimages_on_closed_channel(close_chans_before_reload: bool, close_only_a: bool, hold_post_reload_mon_update: bool) {
3269+
// Test that we can apply a `ChannelMonitorUpdate` with a payment preimage even if the channel
3270+
// is force-closed between when we generate the update on reload and when we go to handle the
3271+
// update or prior to generating the update at all.
3272+
3273+
if !close_chans_before_reload && close_only_a {
3274+
// If we're not closing, it makes no sense to "only close A"
3275+
panic!();
3276+
}
3277+
3278+
let chanmon_cfgs = create_chanmon_cfgs(3);
3279+
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
3280+
3281+
let persister;
3282+
let new_chain_monitor;
3283+
let nodes_1_deserialized;
3284+
3285+
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
3286+
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
3287+
3288+
let chan_id_ab = create_announced_chan_between_nodes(&nodes, 0, 1).2;
3289+
let chan_id_bc = create_announced_chan_between_nodes(&nodes, 1, 2).2;
3290+
3291+
// Route a payment from A, through B, to C, then claim it on C. Once we pass B the
3292+
// `update_fulfill_htlc` we have a monitor update for both of B's channels. We complete the one
3293+
// on the B<->C channel but leave the A<->B monitor update pending, then reload B.
3294+
let (payment_preimage, payment_hash, _) = route_payment(&nodes[0], &[&nodes[1], &nodes[2]], 1_000_000);
3295+
3296+
let mon_ab = get_monitor!(nodes[1], chan_id_ab).encode();
3297+
3298+
nodes[2].node.claim_funds(payment_preimage);
3299+
check_added_monitors(&nodes[2], 1);
3300+
expect_payment_claimed!(nodes[2], payment_hash, 1_000_000);
3301+
3302+
chanmon_cfgs[1].persister.set_update_ret(ChannelMonitorUpdateStatus::InProgress);
3303+
let cs_updates = get_htlc_update_msgs(&nodes[2], &nodes[1].node.get_our_node_id());
3304+
nodes[1].node.handle_update_fulfill_htlc(&nodes[2].node.get_our_node_id(), &cs_updates.update_fulfill_htlcs[0]);
3305+
3306+
// B generates a new monitor update for the A <-> B channel, but doesn't send the new messages
3307+
// for it since the monitor update is marked in-progress.
3308+
check_added_monitors(&nodes[1], 1);
3309+
assert!(nodes[1].node.get_and_clear_pending_msg_events().is_empty());
3310+
3311+
// Now step the Commitment Signed Dance between B and C forward a bit, ensuring we won't get
3312+
// the preimage when the nodes reconnect, at which point we have to ensure we get it from the
3313+
// ChannelMonitor.
3314+
nodes[1].node.handle_commitment_signed(&nodes[2].node.get_our_node_id(), &cs_updates.commitment_signed);
3315+
check_added_monitors(&nodes[1], 1);
3316+
let _ = get_revoke_commit_msgs!(nodes[1], nodes[2].node.get_our_node_id());
3317+
3318+
let mon_bc = get_monitor!(nodes[1], chan_id_bc).encode();
3319+
3320+
if close_chans_before_reload {
3321+
if !close_only_a {
3322+
chanmon_cfgs[1].persister.set_update_ret(ChannelMonitorUpdateStatus::InProgress);
3323+
nodes[1].node.force_close_broadcasting_latest_txn(&chan_id_bc, &nodes[2].node.get_our_node_id()).unwrap();
3324+
check_closed_broadcast(&nodes[1], 1, true);
3325+
check_closed_event(&nodes[1], 1, ClosureReason::HolderForceClosed, false, &[nodes[2].node.get_our_node_id()], 100000);
3326+
}
3327+
3328+
chanmon_cfgs[1].persister.set_update_ret(ChannelMonitorUpdateStatus::InProgress);
3329+
nodes[1].node.force_close_broadcasting_latest_txn(&chan_id_ab, &nodes[0].node.get_our_node_id()).unwrap();
3330+
check_closed_broadcast(&nodes[1], 1, true);
3331+
check_closed_event(&nodes[1], 1, ClosureReason::HolderForceClosed, false, &[nodes[0].node.get_our_node_id()], 100000);
3332+
}
3333+
3334+
// Now reload node B
3335+
let manager_b = nodes[1].node.encode();
3336+
reload_node!(nodes[1], &manager_b, &[&mon_ab, &mon_bc], persister, new_chain_monitor, nodes_1_deserialized);
3337+
3338+
nodes[0].node.peer_disconnected(&nodes[1].node.get_our_node_id());
3339+
nodes[2].node.peer_disconnected(&nodes[1].node.get_our_node_id());
3340+
3341+
if close_chans_before_reload {
3342+
// If the channels were already closed, B will rebroadcast its closing transactions here.
3343+
let bs_close_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap().split_off(0);
3344+
if close_only_a {
3345+
assert_eq!(bs_close_txn.len(), 2);
3346+
} else {
3347+
assert_eq!(bs_close_txn.len(), 3);
3348+
}
3349+
}
3350+
3351+
nodes[0].node.force_close_broadcasting_latest_txn(&chan_id_ab, &nodes[1].node.get_our_node_id()).unwrap();
3352+
check_closed_event(&nodes[0], 1, ClosureReason::HolderForceClosed, false, &[nodes[1].node.get_our_node_id()], 100000);
3353+
let as_closing_tx = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().split_off(0);
3354+
assert_eq!(as_closing_tx.len(), 1);
3355+
3356+
// In order to give B A's closing transaction without processing background events first, use
3357+
// the _without_consistency_checks utility method. This is similar to connecting blocks during
3358+
// startup prior to the node being full initialized.
3359+
mine_transaction_without_consistency_checks(&nodes[1], &as_closing_tx[0]);
3360+
3361+
// After a timer tick a payment preimage ChannelMonitorUpdate is applied to the A<->B
3362+
// ChannelMonitor (possible twice), even though the channel has since been closed.
3363+
check_added_monitors(&nodes[1], 0);
3364+
let mons_added = if close_chans_before_reload { if !close_only_a { 4 } else { 3 } } else { 2 };
3365+
if hold_post_reload_mon_update {
3366+
for _ in 0..mons_added {
3367+
persister.set_update_ret(ChannelMonitorUpdateStatus::InProgress);
3368+
}
3369+
}
3370+
nodes[1].node.timer_tick_occurred();
3371+
check_added_monitors(&nodes[1], mons_added);
3372+
3373+
// Finally, check that B created a payment preimage transaction and close out the payment.
3374+
let bs_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap().split_off(0);
3375+
assert_eq!(bs_txn.len(), if close_chans_before_reload && !close_only_a { 2 } else { 1 });
3376+
let bs_preimage_tx = &bs_txn[0];
3377+
check_spends!(bs_preimage_tx, as_closing_tx[0]);
3378+
3379+
if !close_chans_before_reload {
3380+
check_closed_broadcast(&nodes[1], 1, true);
3381+
check_closed_event(&nodes[1], 1, ClosureReason::CommitmentTxConfirmed, false, &[nodes[0].node.get_our_node_id()], 100000);
3382+
} else {
3383+
// While we forwarded the payment a while ago, we don't want to process events too early or
3384+
// we'll run background tasks we wanted to test individually.
3385+
expect_payment_forwarded!(nodes[1], nodes[0], nodes[2], None, true, !close_only_a);
3386+
}
3387+
3388+
mine_transactions(&nodes[0], &[&as_closing_tx[0], bs_preimage_tx]);
3389+
check_closed_broadcast(&nodes[0], 1, true);
3390+
expect_payment_sent(&nodes[0], payment_preimage, None, true, true);
3391+
3392+
if !close_chans_before_reload || close_only_a {
3393+
// Make sure the B<->C channel is still alive and well by sending a payment over it.
3394+
let mut reconnect_args = ReconnectArgs::new(&nodes[1], &nodes[2]);
3395+
reconnect_args.pending_responding_commitment_signed.1 = true;
3396+
if !close_chans_before_reload {
3397+
// TODO: If the A<->B channel was closed before we reloaded, the `ChannelManager`
3398+
// will consider the forwareded payment complete and allow the B<->C
3399+
// `ChannelMonitorUpdate` to complete, wiping the payment preimage. This should not
3400+
// be allowed, and needs fixing.
3401+
reconnect_args.pending_responding_commitment_signed_dup_monitor.1 = true;
3402+
}
3403+
reconnect_args.pending_raa.1 = true;
3404+
3405+
reconnect_nodes(reconnect_args);
3406+
let (outpoint, ab_update_id, _) = nodes[1].chain_monitor.latest_monitor_update_id.lock().unwrap().get(&chan_id_ab).unwrap().clone();
3407+
nodes[1].chain_monitor.chain_monitor.force_channel_monitor_updated(outpoint, ab_update_id);
3408+
expect_payment_forwarded!(nodes[1], nodes[0], nodes[2], Some(1000), true, false);
3409+
if !close_chans_before_reload {
3410+
// Once we call `process_pending_events` the final `ChannelMonitor` for the B<->C
3411+
// channel will fly, removing the payment preimage from it.
3412+
check_added_monitors(&nodes[1], 1);
3413+
}
3414+
assert!(nodes[1].node.get_and_clear_pending_events().is_empty());
3415+
send_payment(&nodes[1], &[&nodes[2]], 100_000);
3416+
}
3417+
}
3418+
3419+
#[test]
3420+
fn test_durable_preimages_on_closed_channel() {
3421+
do_test_durable_preimages_on_closed_channel(true, true, true);
3422+
do_test_durable_preimages_on_closed_channel(true, true, false);
3423+
do_test_durable_preimages_on_closed_channel(true, false, true);
3424+
do_test_durable_preimages_on_closed_channel(true, false, false);
3425+
do_test_durable_preimages_on_closed_channel(false, false, true);
3426+
do_test_durable_preimages_on_closed_channel(false, false, false);
32243427
}

lightning/src/ln/channelmanager.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ pub(super) enum HTLCForwardInfo {
177177
}
178178

179179
/// Tracks the inbound corresponding to an outbound HTLC
180-
#[derive(Clone, Hash, PartialEq, Eq)]
180+
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
181181
pub(crate) struct HTLCPreviousHopData {
182182
// Note that this may be an outbound SCID alias for the associated channel.
183183
short_channel_id: u64,
@@ -277,7 +277,7 @@ impl Readable for InterceptId {
277277
}
278278
}
279279

280-
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
280+
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
281281
/// Uniquely describes an HTLC by its source. Just the guaranteed-unique subset of [`HTLCSource`].
282282
pub(crate) enum SentHTLCId {
283283
PreviousHopData { short_channel_id: u64, htlc_id: u64 },
@@ -308,7 +308,7 @@ impl_writeable_tlv_based_enum!(SentHTLCId,
308308

309309
/// Tracks the inbound corresponding to an outbound HTLC
310310
#[allow(clippy::derive_hash_xor_eq)] // Our Hash is faithful to the data, we just don't have SecretKey::hash
311-
#[derive(Clone, PartialEq, Eq)]
311+
#[derive(Clone, Debug, PartialEq, Eq)]
312312
pub(crate) enum HTLCSource {
313313
PreviousHopData(HTLCPreviousHopData),
314314
OutboundRoute {

0 commit comments

Comments
 (0)