@@ -4322,7 +4322,7 @@ where
43224322 let current_height: u32 = self.best_block.read().unwrap().height;
43234323 match create_recv_pending_htlc_info(next_hop_data, shared_secret, msg.payment_hash,
43244324 msg.amount_msat, msg.cltv_expiry, None, allow_underpay, msg.skimmed_fee_msat,
4325- current_height, self.default_configuration.accept_mpp_keysend )
4325+ current_height)
43264326 {
43274327 Ok(info) => {
43284328 // Note that we could obviously respond immediately with an update_fulfill_htlc
@@ -5749,7 +5749,7 @@ where
57495749 match create_recv_pending_htlc_info(hop_data,
57505750 incoming_shared_secret, payment_hash, outgoing_amt_msat,
57515751 outgoing_cltv_value, Some(phantom_shared_secret), false, None,
5752- current_height, self.default_configuration.accept_mpp_keysend )
5752+ current_height)
57535753 {
57545754 Ok(info) => phantom_receives.push((
57555755 prev_short_channel_id, prev_counterparty_node_id, prev_funding_outpoint,
@@ -6060,10 +6060,6 @@ where
60606060 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));
60616061 fail_htlc!(claimable_htlc, payment_hash);
60626062 }
6063- if !self.default_configuration.accept_mpp_keysend && is_keysend && !claimable_payment.htlcs.is_empty() {
6064- 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);
6065- fail_htlc!(claimable_htlc, payment_hash);
6066- }
60676063 if let Some(earlier_fields) = &mut claimable_payment.onion_fields {
60686064 if earlier_fields.check_merge(&mut onion_fields).is_err() {
60696065 fail_htlc!(claimable_htlc, payment_hash);
@@ -14201,7 +14197,6 @@ where
1420114197#[cfg(test)]
1420214198mod tests {
1420314199 use bitcoin::hashes::Hash;
14204- use bitcoin::hashes::sha256::Hash as Sha256;
1420514200 use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
1420614201 use core::sync::atomic::Ordering;
1420714202 use crate::events::{Event, HTLCDestination, MessageSendEvent, MessageSendEventsProvider, ClosureReason};
@@ -14418,26 +14413,16 @@ mod tests {
1441814413
1441914414 #[test]
1442014415 fn test_keysend_dup_payment_hash() {
14421- do_test_keysend_dup_payment_hash(false);
14422- do_test_keysend_dup_payment_hash(true);
14423- }
14424-
14425- fn do_test_keysend_dup_payment_hash(accept_mpp_keysend: bool) {
1442614416 // (1): Test that a keysend payment with a duplicate payment hash to an existing pending
1442714417 // outbound regular payment fails as expected.
1442814418 // (2): Test that a regular payment with a duplicate payment hash to an existing keysend payment
1442914419 // fails as expected.
1443014420 // (3): Test that a keysend payment with a duplicate payment hash to an existing keysend
14431- // payment fails as expected. When `accept_mpp_keysend` is false, this tests that we
14432- // reject MPP keysend payments, since in this case where the payment has no payment
14433- // secret, a keysend payment with a duplicate hash is basically an MPP keysend. If
14434- // `accept_mpp_keysend` is true, this tests that we only accept MPP keysends with
14435- // payment secrets and reject otherwise.
14421+ // payment fails as expected. We only accept MPP keysends with payment secrets and reject
14422+ // otherwise.
1443614423 let chanmon_cfgs = create_chanmon_cfgs(2);
1443714424 let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
14438- let mut mpp_keysend_cfg = test_default_channel_config();
14439- mpp_keysend_cfg.accept_mpp_keysend = accept_mpp_keysend;
14440- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, Some(mpp_keysend_cfg)]);
14425+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
1444114426 let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
1444214427 create_announced_chan_between_nodes(&nodes, 0, 1);
1444314428 let scorer = test_utils::TestScorer::new();
@@ -14617,53 +14602,6 @@ mod tests {
1461714602 nodes[1].logger.assert_log_contains("lightning::ln::channelmanager", "Payment preimage didn't match payment hash", 1);
1461814603 }
1461914604
14620- #[test]
14621- fn test_keysend_msg_with_secret_err() {
14622- // Test that we error as expected if we receive a keysend payment that includes a payment
14623- // secret when we don't support MPP keysend.
14624- let mut reject_mpp_keysend_cfg = test_default_channel_config();
14625- reject_mpp_keysend_cfg.accept_mpp_keysend = false;
14626- let chanmon_cfgs = create_chanmon_cfgs(2);
14627- let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
14628- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, Some(reject_mpp_keysend_cfg)]);
14629- let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
14630-
14631- let payer_pubkey = nodes[0].node.get_our_node_id();
14632- let payee_pubkey = nodes[1].node.get_our_node_id();
14633-
14634- let _chan = create_chan_between_nodes(&nodes[0], &nodes[1]);
14635- let route_params = RouteParameters::from_payment_params_and_value(
14636- PaymentParameters::for_keysend(payee_pubkey, 40, false), 10_000);
14637- let network_graph = nodes[0].network_graph;
14638- let first_hops = nodes[0].node.list_usable_channels();
14639- let scorer = test_utils::TestScorer::new();
14640- let random_seed_bytes = chanmon_cfgs[1].keys_manager.get_secure_random_bytes();
14641- let route = find_route(
14642- &payer_pubkey, &route_params, &network_graph, Some(&first_hops.iter().collect::<Vec<_>>()),
14643- nodes[0].logger, &scorer, &Default::default(), &random_seed_bytes
14644- ).unwrap();
14645-
14646- let test_preimage = PaymentPreimage([42; 32]);
14647- let test_secret = PaymentSecret([43; 32]);
14648- let payment_hash = PaymentHash(Sha256::hash(&test_preimage.0).to_byte_array());
14649- let session_privs = nodes[0].node.test_add_new_pending_payment(payment_hash,
14650- RecipientOnionFields::secret_only(test_secret), PaymentId(payment_hash.0), &route).unwrap();
14651- nodes[0].node.test_send_payment_internal(&route, payment_hash,
14652- RecipientOnionFields::secret_only(test_secret), Some(test_preimage),
14653- PaymentId(payment_hash.0), None, session_privs).unwrap();
14654- check_added_monitors!(nodes[0], 1);
14655-
14656- let updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
14657- assert_eq!(updates.update_add_htlcs.len(), 1);
14658- assert!(updates.update_fulfill_htlcs.is_empty());
14659- assert!(updates.update_fail_htlcs.is_empty());
14660- assert!(updates.update_fail_malformed_htlcs.is_empty());
14661- assert!(updates.update_fee.is_none());
14662- nodes[1].node.handle_update_add_htlc(nodes[0].node.get_our_node_id(), &updates.update_add_htlcs[0]);
14663-
14664- nodes[1].logger.assert_log_contains("lightning::ln::channelmanager", "We don't support MPP keysend payments", 1);
14665- }
14666-
1466714605 #[test]
1466814606 fn test_multi_hop_missing_secret() {
1466914607 let chanmon_cfgs = create_chanmon_cfgs(4);
@@ -15298,7 +15236,7 @@ mod tests {
1529815236 if let Err(crate::ln::channelmanager::InboundHTLCErr { err_code, .. }) =
1529915237 create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
1530015238 sender_intended_amt_msat - extra_fee_msat - 1, 42, None, true, Some(extra_fee_msat),
15301- current_height, node[0].node.default_configuration.accept_mpp_keysend )
15239+ current_height)
1530215240 {
1530315241 assert_eq!(err_code, 19);
1530415242 } else { panic!(); }
@@ -15317,7 +15255,7 @@ mod tests {
1531715255 let current_height: u32 = node[0].node.best_block.read().unwrap().height;
1531815256 assert!(create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
1531915257 sender_intended_amt_msat - extra_fee_msat, 42, None, true, Some(extra_fee_msat),
15320- current_height, node[0].node.default_configuration.accept_mpp_keysend ).is_ok());
15258+ current_height).is_ok());
1532115259 }
1532215260
1532315261 #[test]
@@ -15337,8 +15275,7 @@ mod tests {
1533715275 payment_secret: PaymentSecret([0; 32]), total_msat: 100,
1533815276 }),
1533915277 custom_tlvs: Vec::new(),
15340- }, [0; 32], PaymentHash([0; 32]), 100, 23, None, true, None, current_height,
15341- node[0].node.default_configuration.accept_mpp_keysend);
15278+ }, [0; 32], PaymentHash([0; 32]), 100, 23, None, true, None, current_height);
1534215279
1534315280 // Should not return an error as this condition:
1534415281 // https://github.com/lightning/bolts/blob/4dcc377209509b13cf89a4b91fde7d478f5b46d8/04-onion-routing.md?plain=1#L334
0 commit comments