@@ -34,7 +34,6 @@ use bitcoin::hashes::sha256::Hash as Sha256;
34
34
use bitcoin:: secp256k1;
35
35
use bitcoin:: secp256k1:: Secp256k1 ;
36
36
use bitcoin:: secp256k1:: key:: { PublicKey , SecretKey } ;
37
- use bitcoin:: network:: constants:: Network ;
38
37
39
38
use io;
40
39
use prelude:: * ;
@@ -603,15 +602,8 @@ fn test_default_to_onion_payload_tlv_format() {
603
602
// their `features` aren't used when creating the `route`.
604
603
network_graph. clear_nodes_announcement_info ( ) ;
605
604
606
- let scorer = test_utils:: TestScorer :: with_penalty ( 0 ) ;
607
- let seed = [ 0u8 ; 32 ] ;
608
- let keys_manager = test_utils:: TestKeysInterface :: new ( & seed, Network :: Testnet ) ;
609
- let random_seed_bytes = keys_manager. get_secure_random_bytes ( ) ;
610
- let read_only_network_graph = & network_graph. read_only ( ) ;
611
- let announced_route = get_route (
612
- & origin_node. node . get_our_node_id ( ) , & payment_params, read_only_network_graph,
613
- Some ( & origin_node. node . list_usable_channels ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ) ,
614
- 1000000 , TEST_FINAL_CLTV , origin_node. logger , & scorer, & random_seed_bytes) . unwrap ( ) ;
605
+ let ( announced_route, _, _, _) = get_route_and_payment_hash ! (
606
+ origin_node, nodes[ 3 ] , payment_params, 10_000 , TEST_FINAL_CLTV , true ) ;
615
607
616
608
let hops = & announced_route. paths [ 0 ] ;
617
609
// Assert that the hop between `nodes[1]` and `nodes[2]` defaults to supporting variable length
@@ -642,14 +634,12 @@ fn test_default_to_onion_payload_tlv_format() {
642
634
} ] ) ;
643
635
644
636
let unannounced_chan_params = PaymentParameters :: from_node_id ( nodes[ 4 ] . node . get_our_node_id ( ) ) . with_route_hints ( vec ! [ last_hop] ) ;
645
- let unannounced_route = get_route (
646
- & origin_node. node . get_our_node_id ( ) , & unannounced_chan_params, read_only_network_graph,
647
- Some ( & origin_node. node . list_usable_channels ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ) ,
648
- 10000 , TEST_FINAL_CLTV , origin_node. logger , & scorer, & random_seed_bytes) . unwrap ( ) ;
637
+ let ( unannounced_route, _, _, _) = get_route_and_payment_hash ! (
638
+ origin_node, nodes[ 4 ] , unannounced_chan_params, 10_000 , TEST_FINAL_CLTV , true ) ;
649
639
650
640
let unannounced_chan_hop = & unannounced_route. paths [ 0 ] [ 3 ] ;
651
641
// Ensure that `nodes[4]` doesn't exist in `nodes[0]`'s `network_graph`, as it's not public.
652
- assert ! ( read_only_network_graph . nodes( ) . get( & NodeId :: from_pubkey( & nodes[ 4 ] . node. get_our_node_id( ) ) ) . is_none( ) ) ;
642
+ assert ! ( & network_graph . read_only ( ) . nodes( ) . get( & NodeId :: from_pubkey( & nodes[ 4 ] . node. get_our_node_id( ) ) ) . is_none( ) ) ;
653
643
// Assert that the hop between `nodes[3]` and `nodes[4]` defaults to supporting variable length
654
644
// onions, even though `nodes[4]` as `nodes[0]` doesn't exists in `nodes[0]`'s `network_graph`,
655
645
// and no `InvoiceFeatures` for the `payment_params` exists, which would otherwise have been
@@ -703,10 +693,6 @@ fn test_do_not_use_default_to_tlv_onions_if_other_features_not_supporting_them_e
703
693
let origin_node = & nodes[ 0 ] ;
704
694
let network_graph = origin_node. network_graph ;
705
695
network_graph. clear_nodes_announcement_info ( ) ;
706
- let scorer = test_utils:: TestScorer :: with_penalty ( 0 ) ;
707
- let seed = [ 0u8 ; 32 ] ;
708
- let keys_manager = test_utils:: TestKeysInterface :: new ( & seed, Network :: Testnet ) ;
709
- let random_seed_bytes = keys_manager. get_secure_random_bytes ( ) ;
710
696
711
697
// Set `NodeAnnouncementInfo` `features` which do not support variable length onions for
712
698
// `nodes[2]` in `nodes[0]`'s `network_graph`.
@@ -722,10 +708,8 @@ fn test_do_not_use_default_to_tlv_onions_if_other_features_not_supporting_them_e
722
708
} ;
723
709
let _res = network_graph. update_node_from_unsigned_announcement ( & nodes_2_unsigned_node_announcement) ;
724
710
725
- let route = get_route (
726
- & origin_node. node . get_our_node_id ( ) , & payment_params, & network_graph. read_only ( ) ,
727
- Some ( & origin_node. node . list_usable_channels ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ) ,
728
- 1000000 , TEST_FINAL_CLTV , origin_node. logger , & scorer, & random_seed_bytes) . unwrap ( ) ;
711
+ let ( route, _, _, _) = get_route_and_payment_hash ! (
712
+ origin_node, nodes[ 3 ] , payment_params, 10_000 , TEST_FINAL_CLTV , true ) ;
729
713
730
714
let hops = & route. paths [ 0 ] ;
731
715
0 commit comments