@@ -4323,7 +4323,7 @@ where
4323
4323
let current_height: u32 = self.best_block.read().unwrap().height;
4324
4324
match create_recv_pending_htlc_info(next_hop_data, shared_secret, msg.payment_hash,
4325
4325
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)
4327
4327
{
4328
4328
Ok(info) => {
4329
4329
// Note that we could obviously respond immediately with an update_fulfill_htlc
@@ -5750,7 +5750,7 @@ where
5750
5750
match create_recv_pending_htlc_info(hop_data,
5751
5751
incoming_shared_secret, payment_hash, outgoing_amt_msat,
5752
5752
outgoing_cltv_value, Some(phantom_shared_secret), false, None,
5753
- current_height, self.default_configuration.accept_mpp_keysend )
5753
+ current_height)
5754
5754
{
5755
5755
Ok(info) => phantom_receives.push((
5756
5756
prev_short_channel_id, prev_counterparty_node_id, prev_funding_outpoint,
@@ -6061,10 +6061,6 @@ where
6061
6061
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));
6062
6062
fail_htlc!(claimable_htlc, payment_hash);
6063
6063
}
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
- }
6068
6064
if let Some(earlier_fields) = &mut claimable_payment.onion_fields {
6069
6065
if earlier_fields.check_merge(&mut onion_fields).is_err() {
6070
6066
fail_htlc!(claimable_htlc, payment_hash);
@@ -14202,7 +14198,6 @@ where
14202
14198
#[cfg(test)]
14203
14199
mod tests {
14204
14200
use bitcoin::hashes::Hash;
14205
- use bitcoin::hashes::sha256::Hash as Sha256;
14206
14201
use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
14207
14202
use core::sync::atomic::Ordering;
14208
14203
use crate::events::{Event, HTLCDestination, MessageSendEvent, MessageSendEventsProvider, ClosureReason};
@@ -14419,26 +14414,16 @@ mod tests {
14419
14414
14420
14415
#[test]
14421
14416
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) {
14427
14417
// (1): Test that a keysend payment with a duplicate payment hash to an existing pending
14428
14418
// outbound regular payment fails as expected.
14429
14419
// (2): Test that a regular payment with a duplicate payment hash to an existing keysend payment
14430
14420
// fails as expected.
14431
14421
// (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.
14437
14424
let chanmon_cfgs = create_chanmon_cfgs(2);
14438
14425
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]);
14442
14427
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
14443
14428
create_announced_chan_between_nodes(&nodes, 0, 1);
14444
14429
let scorer = test_utils::TestScorer::new();
@@ -14618,53 +14603,6 @@ mod tests {
14618
14603
nodes[1].logger.assert_log_contains("lightning::ln::channelmanager", "Payment preimage didn't match payment hash", 1);
14619
14604
}
14620
14605
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
-
14668
14606
#[test]
14669
14607
fn test_multi_hop_missing_secret() {
14670
14608
let chanmon_cfgs = create_chanmon_cfgs(4);
@@ -15299,7 +15237,7 @@ mod tests {
15299
15237
if let Err(crate::ln::channelmanager::InboundHTLCErr { err_code, .. }) =
15300
15238
create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
15301
15239
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)
15303
15241
{
15304
15242
assert_eq!(err_code, 19);
15305
15243
} else { panic!(); }
@@ -15318,7 +15256,7 @@ mod tests {
15318
15256
let current_height: u32 = node[0].node.best_block.read().unwrap().height;
15319
15257
assert!(create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
15320
15258
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());
15322
15260
}
15323
15261
15324
15262
#[test]
@@ -15338,8 +15276,7 @@ mod tests {
15338
15276
payment_secret: PaymentSecret([0; 32]), total_msat: 100,
15339
15277
}),
15340
15278
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);
15343
15280
15344
15281
// Should not return an error as this condition:
15345
15282
// https://github.com/lightning/bolts/blob/4dcc377209509b13cf89a4b91fde7d478f5b46d8/04-onion-routing.md?plain=1#L334
0 commit comments