@@ -1240,7 +1240,7 @@ fn test_duplicate_htlc_different_direction_onchain() {
1240
1240
let ( payment_preimage, payment_hash, _) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] ) [ ..] , 900_000 ) ;
1241
1241
1242
1242
let ( route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 0 ] , 800_000 ) ;
1243
- let node_a_payment_secret = nodes[ 0 ] . node . create_inbound_payment_for_hash ( payment_hash, None , 7200 ) . unwrap ( ) ;
1243
+ let node_a_payment_secret = nodes[ 0 ] . node . create_inbound_payment_for_hash ( payment_hash, None , 7200 , None ) . unwrap ( ) ;
1244
1244
send_along_route_with_secret ( & nodes[ 1 ] , route, & [ & [ & nodes[ 0 ] ] ] , 800_000 , payment_hash, node_a_payment_secret) ;
1245
1245
1246
1246
// Provide preimage to node 0 by claiming payment
@@ -4723,7 +4723,7 @@ fn test_duplicate_payment_hash_one_failure_one_success() {
4723
4723
4724
4724
let ( our_payment_preimage, duplicate_payment_hash, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 900_000 ) ;
4725
4725
4726
- let payment_secret = nodes[ 3 ] . node . create_inbound_payment_for_hash ( duplicate_payment_hash, None , 7200 ) . unwrap ( ) ;
4726
+ let payment_secret = nodes[ 3 ] . node . create_inbound_payment_for_hash ( duplicate_payment_hash, None , 7200 , None ) . unwrap ( ) ;
4727
4727
// We reduce the final CLTV here by a somewhat arbitrary constant to keep it under the one-byte
4728
4728
// script push size limit so that the below script length checks match
4729
4729
// ACCEPTED_HTLC_SCRIPT_WEIGHT.
@@ -4941,30 +4941,30 @@ fn do_test_fail_backwards_unrevoked_remote_announce(deliver_last_raa: bool, anno
4941
4941
let ( _, payment_hash_2, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 4 ] ] , ds_dust_limit* 1000 ) ; // not added < dust limit + HTLC tx fee
4942
4942
let ( route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 5 ] , ds_dust_limit* 1000 ) ;
4943
4943
// 2nd HTLC:
4944
- send_along_route_with_secret ( & nodes[ 1 ] , route. clone ( ) , & [ & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 5 ] ] ] , ds_dust_limit* 1000 , payment_hash_1, nodes[ 5 ] . node . create_inbound_payment_for_hash ( payment_hash_1, None , 7200 ) . unwrap ( ) ) ; // not added < dust limit + HTLC tx fee
4944
+ send_along_route_with_secret ( & nodes[ 1 ] , route. clone ( ) , & [ & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 5 ] ] ] , ds_dust_limit* 1000 , payment_hash_1, nodes[ 5 ] . node . create_inbound_payment_for_hash ( payment_hash_1, None , 7200 , None ) . unwrap ( ) ) ; // not added < dust limit + HTLC tx fee
4945
4945
// 3rd HTLC:
4946
- send_along_route_with_secret ( & nodes[ 1 ] , route, & [ & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 5 ] ] ] , ds_dust_limit* 1000 , payment_hash_2, nodes[ 5 ] . node . create_inbound_payment_for_hash ( payment_hash_2, None , 7200 ) . unwrap ( ) ) ; // not added < dust limit + HTLC tx fee
4946
+ send_along_route_with_secret ( & nodes[ 1 ] , route, & [ & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 5 ] ] ] , ds_dust_limit* 1000 , payment_hash_2, nodes[ 5 ] . node . create_inbound_payment_for_hash ( payment_hash_2, None , 7200 , None ) . unwrap ( ) ) ; // not added < dust limit + HTLC tx fee
4947
4947
// 4th HTLC:
4948
4948
let ( _, payment_hash_3, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 4 ] ] , 1000000 ) ;
4949
4949
// 5th HTLC:
4950
4950
let ( _, payment_hash_4, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 4 ] ] , 1000000 ) ;
4951
4951
let ( route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 5 ] , 1000000 ) ;
4952
4952
// 6th HTLC:
4953
- send_along_route_with_secret ( & nodes[ 1 ] , route. clone ( ) , & [ & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 5 ] ] ] , 1000000 , payment_hash_3, nodes[ 5 ] . node . create_inbound_payment_for_hash ( payment_hash_3, None , 7200 ) . unwrap ( ) ) ;
4953
+ send_along_route_with_secret ( & nodes[ 1 ] , route. clone ( ) , & [ & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 5 ] ] ] , 1000000 , payment_hash_3, nodes[ 5 ] . node . create_inbound_payment_for_hash ( payment_hash_3, None , 7200 , None ) . unwrap ( ) ) ;
4954
4954
// 7th HTLC:
4955
- send_along_route_with_secret ( & nodes[ 1 ] , route, & [ & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 5 ] ] ] , 1000000 , payment_hash_4, nodes[ 5 ] . node . create_inbound_payment_for_hash ( payment_hash_4, None , 7200 ) . unwrap ( ) ) ;
4955
+ send_along_route_with_secret ( & nodes[ 1 ] , route, & [ & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 5 ] ] ] , 1000000 , payment_hash_4, nodes[ 5 ] . node . create_inbound_payment_for_hash ( payment_hash_4, None , 7200 , None ) . unwrap ( ) ) ;
4956
4956
4957
4957
// 8th HTLC:
4958
4958
let ( _, payment_hash_5, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 4 ] ] , 1000000 ) ;
4959
4959
// 9th HTLC:
4960
4960
let ( route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 5 ] , ds_dust_limit* 1000 ) ;
4961
- send_along_route_with_secret ( & nodes[ 1 ] , route, & [ & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 5 ] ] ] , ds_dust_limit* 1000 , payment_hash_5, nodes[ 5 ] . node . create_inbound_payment_for_hash ( payment_hash_5, None , 7200 ) . unwrap ( ) ) ; // not added < dust limit + HTLC tx fee
4961
+ send_along_route_with_secret ( & nodes[ 1 ] , route, & [ & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 5 ] ] ] , ds_dust_limit* 1000 , payment_hash_5, nodes[ 5 ] . node . create_inbound_payment_for_hash ( payment_hash_5, None , 7200 , None ) . unwrap ( ) ) ; // not added < dust limit + HTLC tx fee
4962
4962
4963
4963
// 10th HTLC:
4964
4964
let ( _, payment_hash_6, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 4 ] ] , ds_dust_limit* 1000 ) ; // not added < dust limit + HTLC tx fee
4965
4965
// 11th HTLC:
4966
4966
let ( route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 5 ] , 1000000 ) ;
4967
- send_along_route_with_secret ( & nodes[ 1 ] , route, & [ & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 5 ] ] ] , 1000000 , payment_hash_6, nodes[ 5 ] . node . create_inbound_payment_for_hash ( payment_hash_6, None , 7200 ) . unwrap ( ) ) ;
4967
+ send_along_route_with_secret ( & nodes[ 1 ] , route, & [ & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 5 ] ] ] , 1000000 , payment_hash_6, nodes[ 5 ] . node . create_inbound_payment_for_hash ( payment_hash_6, None , 7200 , None ) . unwrap ( ) ) ;
4968
4968
4969
4969
// Double-check that six of the new HTLC were added
4970
4970
// We now have six HTLCs pending over the dust limit and six HTLCs under the dust limit (ie,
@@ -6932,7 +6932,7 @@ fn test_check_htlc_underpaying() {
6932
6932
let payment_params = PaymentParameters :: from_node_id ( nodes[ 1 ] . node . get_our_node_id ( ) ) . with_features ( channelmanager:: provided_invoice_features ( ) ) ;
6933
6933
let route = get_route ( & nodes[ 0 ] . node . get_our_node_id ( ) , & payment_params, & nodes[ 0 ] . network_graph . read_only ( ) , None , 10_000 , TEST_FINAL_CLTV , nodes[ 0 ] . logger , & scorer, & random_seed_bytes) . unwrap ( ) ;
6934
6934
let ( _, our_payment_hash, _) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
6935
- let our_payment_secret = nodes[ 1 ] . node . create_inbound_payment_for_hash ( our_payment_hash, Some ( 100_000 ) , 7200 ) . unwrap ( ) ;
6935
+ let our_payment_secret = nodes[ 1 ] . node . create_inbound_payment_for_hash ( our_payment_hash, Some ( 100_000 ) , 7200 , None ) . unwrap ( ) ;
6936
6936
nodes[ 0 ] . node . send_payment ( & route, our_payment_hash, & Some ( our_payment_secret) , PaymentId ( our_payment_hash. 0 ) ) . unwrap ( ) ;
6937
6937
check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
6938
6938
@@ -7935,7 +7935,7 @@ fn test_preimage_storage() {
7935
7935
create_announced_chan_between_nodes ( & nodes, 0 , 1 , channelmanager:: provided_init_features ( ) , channelmanager:: provided_init_features ( ) ) . 0 . contents . short_channel_id ;
7936
7936
7937
7937
{
7938
- let ( payment_hash, payment_secret) = nodes[ 1 ] . node . create_inbound_payment ( Some ( 100_000 ) , 7200 ) . unwrap ( ) ;
7938
+ let ( payment_hash, payment_secret) = nodes[ 1 ] . node . create_inbound_payment ( Some ( 100_000 ) , 7200 , None ) . unwrap ( ) ;
7939
7939
let ( route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 1 ] , 100_000 ) ;
7940
7940
nodes[ 0 ] . node . send_payment ( & route, payment_hash, & Some ( payment_secret) , PaymentId ( payment_hash. 0 ) ) . unwrap ( ) ;
7941
7941
check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
@@ -8041,7 +8041,7 @@ fn test_bad_secret_hash() {
8041
8041
8042
8042
let random_payment_hash = PaymentHash ( [ 42 ; 32 ] ) ;
8043
8043
let random_payment_secret = PaymentSecret ( [ 43 ; 32 ] ) ;
8044
- let ( our_payment_hash, our_payment_secret) = nodes[ 1 ] . node . create_inbound_payment ( Some ( 100_000 ) , 2 ) . unwrap ( ) ;
8044
+ let ( our_payment_hash, our_payment_secret) = nodes[ 1 ] . node . create_inbound_payment ( Some ( 100_000 ) , 2 , None ) . unwrap ( ) ;
8045
8045
let ( route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 1 ] , 100_000 ) ;
8046
8046
8047
8047
// All the below cases should end up being handled exactly identically, so we macro the
0 commit comments