Skip to content

Commit 34af072

Browse files
Refactor test phantom invoice creation to separate function
Unnecessary std feature also removed from tests helpers.
1 parent ee80127 commit 34af072

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

lightning-invoice/src/utils.rs

+14-7
Original file line numberDiff line numberDiff line change
@@ -1536,14 +1536,11 @@ mod test {
15361536
);
15371537
}
15381538

1539-
#[cfg(feature = "std")]
1540-
fn match_multi_node_invoice_routes<'a, 'b: 'a, 'c: 'b>(
1539+
fn create_multi_node_invoice<'a, 'b: 'a, 'c: 'b>(
15411540
invoice_amt: Option<u64>,
15421541
invoice_node: &Node<'a, 'b, 'c>,
15431542
network_multi_nodes: Vec<&Node<'a, 'b, 'c>>,
1544-
mut chan_ids_to_match: HashSet<u64>,
1545-
nodes_contains_public_channels: bool
1546-
){
1543+
)-> (crate::utils::Invoice, HashSet<u64>) {
15471544
let phantom_route_hints = network_multi_nodes.iter()
15481545
.map(|node| node.node.get_phantom_route_hints())
15491546
.collect::<Vec<PhantomRouteHints>>();
@@ -1556,9 +1553,19 @@ mod test {
15561553
3600, phantom_route_hints, &invoice_node.keys_manager, &invoice_node.keys_manager,
15571554
&invoice_node.logger, Currency::BitcoinTestnet, None, Duration::from_secs(1234567)).unwrap();
15581555

1559-
let invoice_hints = invoice.private_routes();
1556+
(invoice, phantom_scids)
1557+
}
1558+
1559+
fn match_multi_node_invoice_routes<'a, 'b: 'a, 'c: 'b>(
1560+
invoice_amt: Option<u64>,
1561+
invoice_node: &Node<'a, 'b, 'c>,
1562+
network_multi_nodes: Vec<&Node<'a, 'b, 'c>>,
1563+
mut chan_ids_to_match: HashSet<u64>,
1564+
nodes_contains_public_channels: bool
1565+
){
1566+
let (invoice, phantom_scids) = create_multi_node_invoice(invoice_amt, invoice_node, network_multi_nodes);
15601567

1561-
for hint in invoice_hints {
1568+
for hint in invoice.private_routes() {
15621569
let hints = &(hint.0).0;
15631570
match hints.len() {
15641571
1 => {

0 commit comments

Comments
 (0)