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