diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index 9f8acd3a457..ed84750590a 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -2931,7 +2931,7 @@ impl ChannelMonitorImpl { htlc_value_satoshis, })); self.htlcs_resolved_on_chain.push(IrrevocablyResolvedHTLC { - commitment_tx_output_idx: commitment_tx_output_idx, resolving_txid: Some(entry.txid), + commitment_tx_output_idx, resolving_txid: Some(entry.txid), payment_preimage: None, }); }, diff --git a/lightning/src/ln/payment_tests.rs b/lightning/src/ln/payment_tests.rs index 57682e69e98..d5d18659c7c 100644 --- a/lightning/src/ln/payment_tests.rs +++ b/lightning/src/ln/payment_tests.rs @@ -589,12 +589,7 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) { let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs); - let (funding_tx, chan_id) = open_zero_conf_channel(&nodes[0], &nodes[1], None); - confirm_transaction(&nodes[0], &funding_tx); - confirm_transaction(&nodes[1], &funding_tx); - // Ignore the announcement_signatures messages - nodes[0].node.get_and_clear_pending_msg_events(); - nodes[1].node.get_and_clear_pending_msg_events(); + let (_, funding_tx, chan_id, ..) = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known()); let chan_id_2 = create_announced_chan_between_nodes(&nodes, 1, 2, InitFeatures::known(), InitFeatures::known()).2; // Serialize the ChannelManager prior to sending payments @@ -731,7 +726,7 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) { assert_eq!(nodes[0].node.list_usable_channels().len(), 1); // If we attempt to retry prior to the HTLC-Timeout (or commitment transaction, for dust HTLCs) - // confirming, we will fail as its considered still-pending... + // confirming, we will fail as it's considered still-pending... let (new_route, _, _, _) = get_route_and_payment_hash!(nodes[0], nodes[2], if use_dust { 1_000 } else { 1_000_000 }); assert!(nodes[0].node.retry_payment(&new_route, payment_id).is_err()); assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty()); @@ -756,7 +751,8 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) { reload_node!(second_new_chain_monitor, second_nodes_0_deserialized, second_persister); reconnect_nodes(&nodes[0], &nodes[1], (true, true), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (false, false)); - // Now resend the payment, delivering the HTLC through to nodes[1] XXX + // Now resend the payment, delivering the HTLC and actually claiming it this time. This ensures + // the payment is not (spuriously) listed as still pending. assert!(nodes[0].node.retry_payment(&new_route, payment_id).is_ok()); check_added_monitors!(nodes[0], 1); pass_along_route(&nodes[0], &[&[&nodes[1], &nodes[2]]], if use_dust { 1_000 } else { 1_000_000 }, payment_hash, payment_secret); @@ -771,6 +767,7 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) { get_monitor!(nodes[0], chan_id_3).write(&mut chan_1_monitor_serialized).unwrap(); nodes_0_serialized = nodes[0].node.encode(); + // Ensure that after reload we cannot retry the payment. reload_node!(third_new_chain_monitor, third_nodes_0_deserialized, third_persister); reconnect_nodes(&nodes[0], &nodes[1], (false, false), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (false, false));