@@ -4323,7 +4323,7 @@ where
43234323 let current_height: u32 = self.best_block.read().unwrap().height;
43244324 match create_recv_pending_htlc_info(next_hop_data, shared_secret, msg.payment_hash,
43254325 msg.amount_msat, msg.cltv_expiry, None, allow_underpay, msg.skimmed_fee_msat,
4326- current_height, self.default_configuration.accept_mpp_keysend )
4326+ current_height)
43274327 {
43284328 Ok(info) => {
43294329 // Note that we could obviously respond immediately with an update_fulfill_htlc
@@ -5750,7 +5750,7 @@ where
57505750 match create_recv_pending_htlc_info(hop_data,
57515751 incoming_shared_secret, payment_hash, outgoing_amt_msat,
57525752 outgoing_cltv_value, Some(phantom_shared_secret), false, None,
5753- current_height, self.default_configuration.accept_mpp_keysend )
5753+ current_height)
57545754 {
57555755 Ok(info) => phantom_receives.push((
57565756 prev_short_channel_id, prev_counterparty_node_id, prev_funding_outpoint,
@@ -6061,10 +6061,6 @@ where
60616061 log_trace!(self.logger, "Failing new {} HTLC with payment_hash {} as we already had an existing {} HTLC with the same payment hash", log_keysend(is_keysend), &payment_hash, log_keysend(!is_keysend));
60626062 fail_htlc!(claimable_htlc, payment_hash);
60636063 }
6064- if !self.default_configuration.accept_mpp_keysend && is_keysend && !claimable_payment.htlcs.is_empty() {
6065- log_trace!(self.logger, "Failing new keysend HTLC with payment_hash {} as we already had an existing keysend HTLC with the same payment hash and our config states we don't accept MPP keysend", &payment_hash);
6066- fail_htlc!(claimable_htlc, payment_hash);
6067- }
60686064 if let Some(earlier_fields) = &mut claimable_payment.onion_fields {
60696065 if earlier_fields.check_merge(&mut onion_fields).is_err() {
60706066 fail_htlc!(claimable_htlc, payment_hash);
@@ -14202,7 +14198,6 @@ where
1420214198#[cfg(test)]
1420314199mod tests {
1420414200 use bitcoin::hashes::Hash;
14205- use bitcoin::hashes::sha256::Hash as Sha256;
1420614201 use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
1420714202 use core::sync::atomic::Ordering;
1420814203 use crate::events::{Event, HTLCDestination, MessageSendEvent, MessageSendEventsProvider, ClosureReason};
@@ -14419,26 +14414,16 @@ mod tests {
1441914414
1442014415 #[test]
1442114416 fn test_keysend_dup_payment_hash() {
14422- do_test_keysend_dup_payment_hash(false);
14423- do_test_keysend_dup_payment_hash(true);
14424- }
14425-
14426- fn do_test_keysend_dup_payment_hash(accept_mpp_keysend: bool) {
1442714417 // (1): Test that a keysend payment with a duplicate payment hash to an existing pending
1442814418 // outbound regular payment fails as expected.
1442914419 // (2): Test that a regular payment with a duplicate payment hash to an existing keysend payment
1443014420 // fails as expected.
1443114421 // (3): Test that a keysend payment with a duplicate payment hash to an existing keysend
14432- // payment fails as expected. When `accept_mpp_keysend` is false, this tests that we
14433- // reject MPP keysend payments, since in this case where the payment has no payment
14434- // secret, a keysend payment with a duplicate hash is basically an MPP keysend. If
14435- // `accept_mpp_keysend` is true, this tests that we only accept MPP keysends with
14436- // payment secrets and reject otherwise.
14422+ // payment fails as expected. We only accept MPP keysends with payment secrets and reject
14423+ // otherwise.
1443714424 let chanmon_cfgs = create_chanmon_cfgs(2);
1443814425 let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
14439- let mut mpp_keysend_cfg = test_default_channel_config();
14440- mpp_keysend_cfg.accept_mpp_keysend = accept_mpp_keysend;
14441- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, Some(mpp_keysend_cfg)]);
14426+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
1444214427 let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
1444314428 create_announced_chan_between_nodes(&nodes, 0, 1);
1444414429 let scorer = test_utils::TestScorer::new();
@@ -14618,53 +14603,6 @@ mod tests {
1461814603 nodes[1].logger.assert_log_contains("lightning::ln::channelmanager", "Payment preimage didn't match payment hash", 1);
1461914604 }
1462014605
14621- #[test]
14622- fn test_keysend_msg_with_secret_err() {
14623- // Test that we error as expected if we receive a keysend payment that includes a payment
14624- // secret when we don't support MPP keysend.
14625- let mut reject_mpp_keysend_cfg = test_default_channel_config();
14626- reject_mpp_keysend_cfg.accept_mpp_keysend = false;
14627- let chanmon_cfgs = create_chanmon_cfgs(2);
14628- let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
14629- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, Some(reject_mpp_keysend_cfg)]);
14630- let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
14631-
14632- let payer_pubkey = nodes[0].node.get_our_node_id();
14633- let payee_pubkey = nodes[1].node.get_our_node_id();
14634-
14635- let _chan = create_chan_between_nodes(&nodes[0], &nodes[1]);
14636- let route_params = RouteParameters::from_payment_params_and_value(
14637- PaymentParameters::for_keysend(payee_pubkey, 40, false), 10_000);
14638- let network_graph = nodes[0].network_graph;
14639- let first_hops = nodes[0].node.list_usable_channels();
14640- let scorer = test_utils::TestScorer::new();
14641- let random_seed_bytes = chanmon_cfgs[1].keys_manager.get_secure_random_bytes();
14642- let route = find_route(
14643- &payer_pubkey, &route_params, &network_graph, Some(&first_hops.iter().collect::<Vec<_>>()),
14644- nodes[0].logger, &scorer, &Default::default(), &random_seed_bytes
14645- ).unwrap();
14646-
14647- let test_preimage = PaymentPreimage([42; 32]);
14648- let test_secret = PaymentSecret([43; 32]);
14649- let payment_hash = PaymentHash(Sha256::hash(&test_preimage.0).to_byte_array());
14650- let session_privs = nodes[0].node.test_add_new_pending_payment(payment_hash,
14651- RecipientOnionFields::secret_only(test_secret), PaymentId(payment_hash.0), &route).unwrap();
14652- nodes[0].node.test_send_payment_internal(&route, payment_hash,
14653- RecipientOnionFields::secret_only(test_secret), Some(test_preimage),
14654- PaymentId(payment_hash.0), None, session_privs).unwrap();
14655- check_added_monitors!(nodes[0], 1);
14656-
14657- let updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
14658- assert_eq!(updates.update_add_htlcs.len(), 1);
14659- assert!(updates.update_fulfill_htlcs.is_empty());
14660- assert!(updates.update_fail_htlcs.is_empty());
14661- assert!(updates.update_fail_malformed_htlcs.is_empty());
14662- assert!(updates.update_fee.is_none());
14663- nodes[1].node.handle_update_add_htlc(nodes[0].node.get_our_node_id(), &updates.update_add_htlcs[0]);
14664-
14665- nodes[1].logger.assert_log_contains("lightning::ln::channelmanager", "We don't support MPP keysend payments", 1);
14666- }
14667-
1466814606 #[test]
1466914607 fn test_multi_hop_missing_secret() {
1467014608 let chanmon_cfgs = create_chanmon_cfgs(4);
@@ -15299,7 +15237,7 @@ mod tests {
1529915237 if let Err(crate::ln::channelmanager::InboundHTLCErr { err_code, .. }) =
1530015238 create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
1530115239 sender_intended_amt_msat - extra_fee_msat - 1, 42, None, true, Some(extra_fee_msat),
15302- current_height, node[0].node.default_configuration.accept_mpp_keysend )
15240+ current_height)
1530315241 {
1530415242 assert_eq!(err_code, 19);
1530515243 } else { panic!(); }
@@ -15318,7 +15256,7 @@ mod tests {
1531815256 let current_height: u32 = node[0].node.best_block.read().unwrap().height;
1531915257 assert!(create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
1532015258 sender_intended_amt_msat - extra_fee_msat, 42, None, true, Some(extra_fee_msat),
15321- current_height, node[0].node.default_configuration.accept_mpp_keysend ).is_ok());
15259+ current_height).is_ok());
1532215260 }
1532315261
1532415262 #[test]
@@ -15338,8 +15276,7 @@ mod tests {
1533815276 payment_secret: PaymentSecret([0; 32]), total_msat: 100,
1533915277 }),
1534015278 custom_tlvs: Vec::new(),
15341- }, [0; 32], PaymentHash([0; 32]), 100, 23, None, true, None, current_height,
15342- node[0].node.default_configuration.accept_mpp_keysend);
15279+ }, [0; 32], PaymentHash([0; 32]), 100, 23, None, true, None, current_height);
1534315280
1534415281 // Should not return an error as this condition:
1534515282 // https://github.com/lightning/bolts/blob/4dcc377209509b13cf89a4b91fde7d478f5b46d8/04-onion-routing.md?plain=1#L334
0 commit comments