Skip to content

Commit c31e417

Browse files
Refactor test phantom invoice creation to separate function
1 parent f7061cd commit c31e417

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

lightning-invoice/src/utils.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,13 +1539,11 @@ mod test {
15391539
}
15401540

15411541
#[cfg(feature = "std")]
1542-
fn match_multi_node_invoice_routes<'a, 'b: 'a, 'c: 'b>(
1542+
fn create_multi_node_invoice<'a, 'b: 'a, 'c: 'b>(
15431543
invoice_amt: Option<u64>,
15441544
invoice_node: &Node<'a, 'b, 'c>,
15451545
network_multi_nodes: Vec<&Node<'a, 'b, 'c>>,
1546-
mut chan_ids_to_match: HashSet<u64>,
1547-
nodes_contains_public_channels: bool
1548-
){
1546+
)-> (crate::utils::Invoice, HashSet<u64>) {
15491547
let phantom_route_hints = network_multi_nodes.iter()
15501548
.map(|node| node.node.get_phantom_route_hints())
15511549
.collect::<Vec<PhantomRouteHints>>();
@@ -1558,9 +1556,20 @@ mod test {
15581556
3600, phantom_route_hints, &invoice_node.keys_manager, &invoice_node.keys_manager,
15591557
&invoice_node.logger, Currency::BitcoinTestnet, None, Duration::from_secs(1234567)).unwrap();
15601558

1561-
let invoice_hints = invoice.private_routes();
1559+
(invoice, phantom_scids)
1560+
}
1561+
1562+
#[cfg(feature = "std")]
1563+
fn match_multi_node_invoice_routes<'a, 'b: 'a, 'c: 'b>(
1564+
invoice_amt: Option<u64>,
1565+
invoice_node: &Node<'a, 'b, 'c>,
1566+
network_multi_nodes: Vec<&Node<'a, 'b, 'c>>,
1567+
mut chan_ids_to_match: HashSet<u64>,
1568+
nodes_contains_public_channels: bool
1569+
){
1570+
let (invoice, phantom_scids) = create_multi_node_invoice(invoice_amt, invoice_node, network_multi_nodes);
15621571

1563-
for hint in invoice_hints {
1572+
for hint in invoice.private_routes() {
15641573
let hints = &(hint.0).0;
15651574
match hints.len() {
15661575
1 => {

0 commit comments

Comments
 (0)