Skip to content

Commit 12937fc

Browse files
committed
Update DefaultMessageRouter to always create compact blinded paths
1 parent f8c37fb commit 12937fc

File tree

5 files changed

+95
-73
lines changed

5 files changed

+95
-73
lines changed

lightning-dns-resolver/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ mod test {
369369
#[tokio::test]
370370
async fn end_to_end_test() {
371371
let chanmon_cfgs = create_chanmon_cfgs(2);
372-
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
372+
let node_cfgs = create_node_cfgs_with_node_id_message_router(2, &chanmon_cfgs);
373373
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
374374
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
375375

lightning/src/ln/functional_test_utils.rs

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use crate::util::logger::Logger;
3232
use crate::util::scid_utils;
3333
use crate::util::test_channel_signer::TestChannelSigner;
3434
use crate::util::test_channel_signer::SignerOp;
35-
use crate::util::test_utils;
35+
use crate::util::test_utils::{self, TestLogger, TestMessageRouter};
3636
use crate::util::test_utils::{TestChainMonitor, TestScorer, TestKeysInterface};
3737
use crate::util::ser::{ReadableArgs, Writeable};
3838

@@ -3293,24 +3293,35 @@ pub fn create_chanmon_cfgs_with_keys(node_count: usize, predefined_keys_ids: Opt
32933293
chan_mon_cfgs
32943294
}
32953295

3296-
pub fn create_node_cfgs<'a>(node_count: usize, chanmon_cfgs: &'a Vec<TestChanMonCfg>) -> Vec<NodeCfg<'a>> {
3297-
create_node_cfgs_with_persisters(node_count, chanmon_cfgs, chanmon_cfgs.iter().map(|c| &c.persister).collect())
3298-
}
3299-
3300-
pub fn create_node_cfgs_with_persisters<'a>(node_count: usize, chanmon_cfgs: &'a Vec<TestChanMonCfg>, persisters: Vec<&'a impl Persist<TestChannelSigner>>) -> Vec<NodeCfg<'a>> {
3296+
fn create_node_cfgs_internal<'a, F>(
3297+
node_count: usize,
3298+
chanmon_cfgs: &'a Vec<TestChanMonCfg>,
3299+
persisters: Vec<&'a impl Persist<TestChannelSigner>>,
3300+
message_router_constructor: F,
3301+
) -> Vec<NodeCfg<'a>>
3302+
where
3303+
F: Fn(Arc<NetworkGraph<&'a TestLogger>>, &'a TestKeysInterface) -> TestMessageRouter<'a>,
3304+
{
33013305
let mut nodes = Vec::new();
33023306

33033307
for i in 0..node_count {
3304-
let chain_monitor = test_utils::TestChainMonitor::new(Some(&chanmon_cfgs[i].chain_source), &chanmon_cfgs[i].tx_broadcaster, &chanmon_cfgs[i].logger, &chanmon_cfgs[i].fee_estimator, persisters[i], &chanmon_cfgs[i].keys_manager);
33053308
let network_graph = Arc::new(NetworkGraph::new(Network::Testnet, &chanmon_cfgs[i].logger));
3309+
let chain_monitor = test_utils::TestChainMonitor::new(
3310+
Some(&chanmon_cfgs[i].chain_source),
3311+
&chanmon_cfgs[i].tx_broadcaster,
3312+
&chanmon_cfgs[i].logger,
3313+
&chanmon_cfgs[i].fee_estimator,
3314+
persisters[i],
3315+
&chanmon_cfgs[i].keys_manager,
3316+
);
33063317
let seed = [i as u8; 32];
33073318
nodes.push(NodeCfg {
33083319
chain_source: &chanmon_cfgs[i].chain_source,
33093320
logger: &chanmon_cfgs[i].logger,
33103321
tx_broadcaster: &chanmon_cfgs[i].tx_broadcaster,
33113322
fee_estimator: &chanmon_cfgs[i].fee_estimator,
33123323
router: test_utils::TestRouter::new(network_graph.clone(), &chanmon_cfgs[i].logger, &chanmon_cfgs[i].scorer),
3313-
message_router: test_utils::TestMessageRouter::new_default(network_graph.clone(), &chanmon_cfgs[i].keys_manager),
3324+
message_router: message_router_constructor(network_graph.clone(), &chanmon_cfgs[i].keys_manager),
33143325
chain_monitor,
33153326
keys_manager: &chanmon_cfgs[i].keys_manager,
33163327
node_seed: seed,
@@ -3322,33 +3333,29 @@ pub fn create_node_cfgs_with_persisters<'a>(node_count: usize, chanmon_cfgs: &'a
33223333
nodes
33233334
}
33243335

3325-
pub fn create_node_cfgs_with_node_id_message_router<'a>(node_count: usize, chanmon_cfgs: &'a Vec<TestChanMonCfg>) -> Vec<NodeCfg<'a>> {
3326-
let persisters: Vec<_> = chanmon_cfgs.iter().map(|c| &c.persister).collect();
3327-
3328-
let mut nodes = Vec::new();
3329-
3330-
for i in 0..node_count {
3331-
let chain_monitor = test_utils::TestChainMonitor::new(Some(&chanmon_cfgs[i].chain_source), &chanmon_cfgs[i].tx_broadcaster, &chanmon_cfgs[i].logger, &chanmon_cfgs[i].fee_estimator, persisters[i], &chanmon_cfgs[i].keys_manager);
3332-
let network_graph = Arc::new(NetworkGraph::new(Network::Testnet, &chanmon_cfgs[i].logger));
3333-
let seed = [i as u8; 32];
3334-
nodes.push(NodeCfg {
3335-
chain_source: &chanmon_cfgs[i].chain_source,
3336-
logger: &chanmon_cfgs[i].logger,
3337-
tx_broadcaster: &chanmon_cfgs[i].tx_broadcaster,
3338-
fee_estimator: &chanmon_cfgs[i].fee_estimator,
3339-
router: test_utils::TestRouter::new(network_graph.clone(), &chanmon_cfgs[i].logger, &chanmon_cfgs[i].scorer),
3340-
message_router: test_utils::TestMessageRouter::new_node_id_router(network_graph.clone(), &chanmon_cfgs[i].keys_manager),
3341-
chain_monitor,
3342-
keys_manager: &chanmon_cfgs[i].keys_manager,
3343-
node_seed: seed,
3344-
network_graph,
3345-
override_init_features: Rc::new(RefCell::new(None)),
3346-
});
3347-
}
3336+
pub fn create_node_cfgs<'a>(node_count: usize, chanmon_cfgs: &'a Vec<TestChanMonCfg>) -> Vec<NodeCfg<'a>> {
3337+
create_node_cfgs_with_persisters(
3338+
node_count,
3339+
chanmon_cfgs,
3340+
chanmon_cfgs.iter().map(|c| &c.persister).collect(),
3341+
)
3342+
}
33483343

3349-
nodes
3344+
pub fn create_node_cfgs_with_persisters<'a>(
3345+
node_count: usize,
3346+
chanmon_cfgs: &'a Vec<TestChanMonCfg>,
3347+
persisters: Vec<&'a impl Persist<TestChannelSigner>>,
3348+
) -> Vec<NodeCfg<'a>> {
3349+
create_node_cfgs_internal(node_count, chanmon_cfgs, persisters, test_utils::TestMessageRouter::new_default)
33503350
}
33513351

3352+
pub fn create_node_cfgs_with_node_id_message_router<'a>(
3353+
node_count: usize,
3354+
chanmon_cfgs: &'a Vec<TestChanMonCfg>,
3355+
) -> Vec<NodeCfg<'a>> {
3356+
let persisters: Vec<_> = chanmon_cfgs.iter().map(|c| &c.persister).collect();
3357+
create_node_cfgs_internal(node_count, chanmon_cfgs, persisters, test_utils::TestMessageRouter::new_node_id_router)
3358+
}
33523359

33533360
pub fn test_default_channel_config() -> UserConfig {
33543361
let mut default_config = UserConfig::default();

lightning/src/ln/offers_tests.rs

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,16 @@ fn resolve_introduction_node<'a, 'b, 'c>(node: &Node<'a, 'b, 'c>, path: &Blinded
148148
.unwrap()
149149
}
150150

151+
fn check_compact_path_introduction_node<'a, 'b, 'c>(
152+
path: &BlindedMessagePath,
153+
lookup_node: &Node<'a, 'b, 'c>,
154+
expected_introduction_node: PublicKey,
155+
) -> bool {
156+
let introduction_node_id = resolve_introduction_node(lookup_node, path);
157+
introduction_node_id == expected_introduction_node
158+
&& matches!(path.introduction_node(), IntroductionNode::DirectedShortChannelId(..))
159+
}
160+
151161
fn route_bolt12_payment<'a, 'b, 'c>(
152162
node: &Node<'a, 'b, 'c>, path: &[&Node<'a, 'b, 'c>], invoice: &Bolt12Invoice
153163
) {
@@ -406,7 +416,7 @@ fn creates_short_lived_offer() {
406416
#[test]
407417
fn creates_long_lived_offer() {
408418
let chanmon_cfgs = create_chanmon_cfgs(2);
409-
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
419+
let node_cfgs = create_node_cfgs_with_node_id_message_router(2, &chanmon_cfgs);
410420
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
411421
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
412422

@@ -470,7 +480,7 @@ fn creates_short_lived_refund() {
470480
#[test]
471481
fn creates_long_lived_refund() {
472482
let chanmon_cfgs = create_chanmon_cfgs(2);
473-
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
483+
let node_cfgs = create_node_cfgs_with_node_id_message_router(2, &chanmon_cfgs);
474484
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
475485
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
476486

@@ -539,7 +549,7 @@ fn creates_and_pays_for_offer_using_two_hop_blinded_path() {
539549
assert_ne!(offer.issuer_signing_pubkey(), Some(alice_id));
540550
assert!(!offer.paths().is_empty());
541551
for path in offer.paths() {
542-
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(bob_id));
552+
assert!(check_compact_path_introduction_node(&path, alice, bob_id));
543553
}
544554

545555
let payment_id = PaymentId([1; 32]);
@@ -569,7 +579,7 @@ fn creates_and_pays_for_offer_using_two_hop_blinded_path() {
569579
});
570580
assert_eq!(invoice_request.amount_msats(), Some(10_000_000));
571581
assert_ne!(invoice_request.payer_signing_pubkey(), david_id);
572-
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
582+
assert!(check_compact_path_introduction_node(&reply_path, bob, charlie_id));
573583

574584
let onion_message = alice.onion_messenger.next_onion_message_for_peer(charlie_id).unwrap();
575585
charlie.onion_messenger.handle_onion_message(alice_id, &onion_message);
@@ -588,10 +598,8 @@ fn creates_and_pays_for_offer_using_two_hop_blinded_path() {
588598
// to Alice when she's handling the message. Therefore, either Bob or Charlie could
589599
// serve as the introduction node for the reply path back to Alice.
590600
assert!(
591-
matches!(
592-
reply_path.introduction_node(),
593-
&IntroductionNode::NodeId(node_id) if node_id == bob_id || node_id == charlie_id,
594-
)
601+
check_compact_path_introduction_node(&reply_path, david, bob_id) ||
602+
check_compact_path_introduction_node(&reply_path, david, charlie_id)
595603
);
596604

597605
route_bolt12_payment(david, &[charlie, bob, alice], &invoice);
@@ -650,7 +658,7 @@ fn creates_and_pays_for_refund_using_two_hop_blinded_path() {
650658
assert_ne!(refund.payer_signing_pubkey(), david_id);
651659
assert!(!refund.paths().is_empty());
652660
for path in refund.paths() {
653-
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
661+
assert!(check_compact_path_introduction_node(&path, david, charlie_id));
654662
}
655663
expect_recent_payment!(david, RecentPaymentDetails::AwaitingInvoice, payment_id);
656664

@@ -674,8 +682,7 @@ fn creates_and_pays_for_refund_using_two_hop_blinded_path() {
674682
for path in invoice.payment_paths() {
675683
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(bob_id));
676684
}
677-
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(bob_id));
678-
685+
assert!(check_compact_path_introduction_node(&reply_path, alice, bob_id));
679686

680687
route_bolt12_payment(david, &[charlie, bob, alice], &invoice);
681688
expect_recent_payment!(david, RecentPaymentDetails::Pending, payment_id);
@@ -708,7 +715,7 @@ fn creates_and_pays_for_offer_using_one_hop_blinded_path() {
708715
assert_ne!(offer.issuer_signing_pubkey(), Some(alice_id));
709716
assert!(!offer.paths().is_empty());
710717
for path in offer.paths() {
711-
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(alice_id));
718+
assert!(check_compact_path_introduction_node(&path, bob, alice_id));
712719
}
713720

714721
let payment_id = PaymentId([1; 32]);
@@ -730,7 +737,7 @@ fn creates_and_pays_for_offer_using_one_hop_blinded_path() {
730737
});
731738
assert_eq!(invoice_request.amount_msats(), Some(10_000_000));
732739
assert_ne!(invoice_request.payer_signing_pubkey(), bob_id);
733-
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(bob_id));
740+
assert!(check_compact_path_introduction_node(&reply_path, alice, bob_id));
734741

735742
let onion_message = alice.onion_messenger.next_onion_message_for_peer(bob_id).unwrap();
736743
bob.onion_messenger.handle_onion_message(alice_id, &onion_message);
@@ -742,7 +749,7 @@ fn creates_and_pays_for_offer_using_one_hop_blinded_path() {
742749
for path in invoice.payment_paths() {
743750
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(alice_id));
744751
}
745-
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(alice_id));
752+
assert!(check_compact_path_introduction_node(&reply_path, bob, alice_id));
746753

747754
route_bolt12_payment(bob, &[alice], &invoice);
748755
expect_recent_payment!(bob, RecentPaymentDetails::Pending, payment_id);
@@ -779,7 +786,7 @@ fn creates_and_pays_for_refund_using_one_hop_blinded_path() {
779786
assert_ne!(refund.payer_signing_pubkey(), bob_id);
780787
assert!(!refund.paths().is_empty());
781788
for path in refund.paths() {
782-
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(bob_id));
789+
assert!(check_compact_path_introduction_node(&path, alice, bob_id));
783790
}
784791
expect_recent_payment!(bob, RecentPaymentDetails::AwaitingInvoice, payment_id);
785792

@@ -798,7 +805,7 @@ fn creates_and_pays_for_refund_using_one_hop_blinded_path() {
798805
for path in invoice.payment_paths() {
799806
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(alice_id));
800807
}
801-
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(alice_id));
808+
assert!(check_compact_path_introduction_node(&reply_path, bob, alice_id));
802809

803810
route_bolt12_payment(bob, &[alice], &invoice);
804811
expect_recent_payment!(bob, RecentPaymentDetails::Pending, payment_id);
@@ -956,7 +963,7 @@ fn send_invoice_requests_with_distinct_reply_path() {
956963
assert_ne!(offer.issuer_signing_pubkey(), Some(alice_id));
957964
assert!(!offer.paths().is_empty());
958965
for path in offer.paths() {
959-
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(bob_id));
966+
assert!(check_compact_path_introduction_node(&path, alice, bob_id));
960967
}
961968

962969
let payment_id = PaymentId([1; 32]);
@@ -975,7 +982,7 @@ fn send_invoice_requests_with_distinct_reply_path() {
975982
alice.onion_messenger.handle_onion_message(bob_id, &onion_message);
976983

977984
let (_, reply_path) = extract_invoice_request(alice, &onion_message);
978-
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
985+
assert!(check_compact_path_introduction_node(&reply_path, alice, charlie_id));
979986

980987
// Send, extract and verify the second Invoice Request message
981988
let onion_message = david.onion_messenger.next_onion_message_for_peer(bob_id).unwrap();
@@ -985,7 +992,7 @@ fn send_invoice_requests_with_distinct_reply_path() {
985992
alice.onion_messenger.handle_onion_message(bob_id, &onion_message);
986993

987994
let (_, reply_path) = extract_invoice_request(alice, &onion_message);
988-
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(nodes[6].node.get_our_node_id()));
995+
assert!(check_compact_path_introduction_node(&reply_path, alice, nodes[6].node.get_our_node_id()));
989996
}
990997

991998
/// This test checks that when multiple potential introduction nodes are available for the payee,
@@ -1040,7 +1047,7 @@ fn send_invoice_for_refund_with_distinct_reply_path() {
10401047
.build().unwrap();
10411048
assert_ne!(refund.payer_signing_pubkey(), alice_id);
10421049
for path in refund.paths() {
1043-
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(bob_id));
1050+
assert!(check_compact_path_introduction_node(&path, alice, bob_id));
10441051
}
10451052
expect_recent_payment!(alice, RecentPaymentDetails::AwaitingInvoice, payment_id);
10461053

@@ -1056,7 +1063,7 @@ fn send_invoice_for_refund_with_distinct_reply_path() {
10561063
let onion_message = bob.onion_messenger.next_onion_message_for_peer(alice_id).unwrap();
10571064

10581065
let (_, reply_path) = extract_invoice(alice, &onion_message);
1059-
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
1066+
assert!(check_compact_path_introduction_node(&reply_path, alice, charlie_id));
10601067

10611068
// Send, extract and verify the second Invoice Request message
10621069
let onion_message = david.onion_messenger.next_onion_message_for_peer(bob_id).unwrap();
@@ -1065,7 +1072,7 @@ fn send_invoice_for_refund_with_distinct_reply_path() {
10651072
let onion_message = bob.onion_messenger.next_onion_message_for_peer(alice_id).unwrap();
10661073

10671074
let (_, reply_path) = extract_invoice(alice, &onion_message);
1068-
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(nodes[6].node.get_our_node_id()));
1075+
assert!(check_compact_path_introduction_node(&reply_path, alice, nodes[6].node.get_our_node_id()));
10691076
}
10701077

10711078
/// Verifies that the invoice request message can be retried if it fails to reach the
@@ -1091,7 +1098,7 @@ fn creates_and_pays_for_offer_with_retry() {
10911098
assert_ne!(offer.issuer_signing_pubkey(), Some(alice_id));
10921099
assert!(!offer.paths().is_empty());
10931100
for path in offer.paths() {
1094-
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(alice_id));
1101+
assert!(check_compact_path_introduction_node(&path, bob, alice_id));
10951102
}
10961103
let payment_id = PaymentId([1; 32]);
10971104
bob.node.pay_for_offer(&offer, None, None, None, payment_id, Retry::Attempts(0), RouteParametersConfig::default()).unwrap();
@@ -1119,7 +1126,7 @@ fn creates_and_pays_for_offer_with_retry() {
11191126
});
11201127
assert_eq!(invoice_request.amount_msats(), Some(10_000_000));
11211128
assert_ne!(invoice_request.payer_signing_pubkey(), bob_id);
1122-
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(bob_id));
1129+
assert!(check_compact_path_introduction_node(&reply_path, alice, bob_id));
11231130
let onion_message = alice.onion_messenger.next_onion_message_for_peer(bob_id).unwrap();
11241131
bob.onion_messenger.handle_onion_message(alice_id, &onion_message);
11251132

@@ -1384,7 +1391,7 @@ fn fails_authentication_when_handling_invoice_request() {
13841391
assert_ne!(offer.issuer_signing_pubkey(), Some(alice_id));
13851392
assert!(!offer.paths().is_empty());
13861393
for path in offer.paths() {
1387-
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(bob_id));
1394+
assert!(check_compact_path_introduction_node(&path, alice, bob_id));
13881395
}
13891396

13901397
let invalid_path = alice.node
@@ -1393,7 +1400,7 @@ fn fails_authentication_when_handling_invoice_request() {
13931400
.build().unwrap()
13941401
.paths().first().unwrap()
13951402
.clone();
1396-
assert_eq!(invalid_path.introduction_node(), &IntroductionNode::NodeId(bob_id));
1403+
assert!(check_compact_path_introduction_node(&invalid_path, alice, bob_id));
13971404

13981405
// Send the invoice request directly to Alice instead of using a blinded path.
13991406
let payment_id = PaymentId([1; 32]);
@@ -1414,7 +1421,7 @@ fn fails_authentication_when_handling_invoice_request() {
14141421
let (invoice_request, reply_path) = extract_invoice_request(alice, &onion_message);
14151422
assert_eq!(invoice_request.amount_msats(), Some(10_000_000));
14161423
assert_ne!(invoice_request.payer_signing_pubkey(), david_id);
1417-
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
1424+
assert!(check_compact_path_introduction_node(&reply_path, david, charlie_id));
14181425

14191426
assert_eq!(alice.onion_messenger.next_onion_message_for_peer(charlie_id), None);
14201427

@@ -1444,7 +1451,7 @@ fn fails_authentication_when_handling_invoice_request() {
14441451
let (invoice_request, reply_path) = extract_invoice_request(alice, &onion_message);
14451452
assert_eq!(invoice_request.amount_msats(), Some(10_000_000));
14461453
assert_ne!(invoice_request.payer_signing_pubkey(), david_id);
1447-
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
1454+
assert!(check_compact_path_introduction_node(&reply_path, david, charlie_id));
14481455

14491456
assert_eq!(alice.onion_messenger.next_onion_message_for_peer(charlie_id), None);
14501457
}
@@ -1495,7 +1502,7 @@ fn fails_authentication_when_handling_invoice_for_offer() {
14951502
assert_ne!(offer.issuer_signing_pubkey(), Some(alice_id));
14961503
assert!(!offer.paths().is_empty());
14971504
for path in offer.paths() {
1498-
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(bob_id));
1505+
assert!(check_compact_path_introduction_node(&path, alice, bob_id));
14991506
}
15001507

15011508
// Initiate an invoice request, but abandon tracking it.
@@ -1546,7 +1553,7 @@ fn fails_authentication_when_handling_invoice_for_offer() {
15461553
let (invoice_request, reply_path) = extract_invoice_request(alice, &onion_message);
15471554
assert_eq!(invoice_request.amount_msats(), Some(10_000_000));
15481555
assert_ne!(invoice_request.payer_signing_pubkey(), david_id);
1549-
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
1556+
assert!(check_compact_path_introduction_node(&reply_path, david, charlie_id));
15501557

15511558
let onion_message = alice.onion_messenger.next_onion_message_for_peer(charlie_id).unwrap();
15521559
charlie.onion_messenger.handle_onion_message(alice_id, &onion_message);
@@ -1603,7 +1610,7 @@ fn fails_authentication_when_handling_invoice_for_refund() {
16031610
assert_ne!(refund.payer_signing_pubkey(), david_id);
16041611
assert!(!refund.paths().is_empty());
16051612
for path in refund.paths() {
1606-
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
1613+
assert!(check_compact_path_introduction_node(&path, david, charlie_id));
16071614
}
16081615
expect_recent_payment!(david, RecentPaymentDetails::AwaitingInvoice, payment_id);
16091616

@@ -1637,7 +1644,7 @@ fn fails_authentication_when_handling_invoice_for_refund() {
16371644
assert_ne!(refund.payer_signing_pubkey(), david_id);
16381645
assert!(!refund.paths().is_empty());
16391646
for path in refund.paths() {
1640-
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
1647+
assert!(check_compact_path_introduction_node(&path, david, charlie_id));
16411648
}
16421649

16431650
let expected_invoice = alice.node.request_refund_payment(&refund).unwrap();

lightning/src/onion_message/messenger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ where
684684
peers.into_iter(),
685685
&self.entropy_source,
686686
secp_ctx,
687-
false,
687+
true,
688688
)
689689
}
690690

0 commit comments

Comments
 (0)