@@ -1152,7 +1152,7 @@ fn test_duplicate_htlc_different_direction_onchain() {
1152
1152
let ( payment_preimage, payment_hash, _) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] ) [ ..] , 900_000 ) ;
1153
1153
1154
1154
let ( route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 0 ] , 800_000 ) ;
1155
- let node_a_payment_secret = nodes[ 0 ] . node . create_inbound_payment_for_hash ( payment_hash, None , 7200 , 0 ) . unwrap ( ) ;
1155
+ let node_a_payment_secret = nodes[ 0 ] . node . create_inbound_payment_for_hash ( payment_hash, None , 7200 ) . unwrap ( ) ;
1156
1156
send_along_route_with_secret ( & nodes[ 1 ] , route, & [ & [ & nodes[ 0 ] ] ] , 800_000 , payment_hash, node_a_payment_secret) ;
1157
1157
1158
1158
// Provide preimage to node 0 by claiming payment
@@ -4957,7 +4957,7 @@ fn test_duplicate_payment_hash_one_failure_one_success() {
4957
4957
4958
4958
let ( our_payment_preimage, duplicate_payment_hash, _) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 900000 ) ;
4959
4959
4960
- let payment_secret = nodes[ 3 ] . node . create_inbound_payment_for_hash ( duplicate_payment_hash, None , 7200 , 0 ) . unwrap ( ) ;
4960
+ let payment_secret = nodes[ 3 ] . node . create_inbound_payment_for_hash ( duplicate_payment_hash, None , 7200 ) . unwrap ( ) ;
4961
4961
// We reduce the final CLTV here by a somewhat arbitrary constant to keep it under the one-byte
4962
4962
// script push size limit so that the below script length checks match
4963
4963
// ACCEPTED_HTLC_SCRIPT_WEIGHT.
@@ -5160,30 +5160,30 @@ fn do_test_fail_backwards_unrevoked_remote_announce(deliver_last_raa: bool, anno
5160
5160
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
5161
5161
let ( route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 5 ] , ds_dust_limit* 1000 ) ;
5162
5162
// 2nd HTLC:
5163
- 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 , 0 ) . unwrap ( ) ) ; // not added < dust limit + HTLC tx fee
5163
+ 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
5164
5164
// 3rd HTLC:
5165
- 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 , 0 ) . unwrap ( ) ) ; // not added < dust limit + HTLC tx fee
5165
+ 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
5166
5166
// 4th HTLC:
5167
5167
let ( _, payment_hash_3, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 4 ] ] , 1000000 ) ;
5168
5168
// 5th HTLC:
5169
5169
let ( _, payment_hash_4, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 4 ] ] , 1000000 ) ;
5170
5170
let ( route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 5 ] , 1000000 ) ;
5171
5171
// 6th HTLC:
5172
- 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 , 0 ) . unwrap ( ) ) ;
5172
+ 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 ( ) ) ;
5173
5173
// 7th HTLC:
5174
- 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 , 0 ) . unwrap ( ) ) ;
5174
+ 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 ( ) ) ;
5175
5175
5176
5176
// 8th HTLC:
5177
5177
let ( _, payment_hash_5, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 4 ] ] , 1000000 ) ;
5178
5178
// 9th HTLC:
5179
5179
let ( route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 5 ] , ds_dust_limit* 1000 ) ;
5180
- 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 , 0 ) . unwrap ( ) ) ; // not added < dust limit + HTLC tx fee
5180
+ 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
5181
5181
5182
5182
// 10th HTLC:
5183
5183
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
5184
5184
// 11th HTLC:
5185
5185
let ( route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 5 ] , 1000000 ) ;
5186
- 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 , 0 ) . unwrap ( ) ) ;
5186
+ 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 ( ) ) ;
5187
5187
5188
5188
// Double-check that six of the new HTLC were added
5189
5189
// We now have six HTLCs pending over the dust limit and six HTLCs under the dust limit (ie,
@@ -7164,7 +7164,7 @@ fn test_check_htlc_underpaying() {
7164
7164
let payee = Payee :: from_node_id ( nodes[ 1 ] . node . get_our_node_id ( ) ) . with_features ( InvoiceFeatures :: known ( ) ) ;
7165
7165
let route = get_route ( & nodes[ 0 ] . node . get_our_node_id ( ) , & payee, nodes[ 0 ] . network_graph , None , 10_000 , TEST_FINAL_CLTV , nodes[ 0 ] . logger , & scorer) . unwrap ( ) ;
7166
7166
let ( _, our_payment_hash, _) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
7167
- let our_payment_secret = nodes[ 1 ] . node . create_inbound_payment_for_hash ( our_payment_hash, Some ( 100_000 ) , 7200 , 0 ) . unwrap ( ) ;
7167
+ let our_payment_secret = nodes[ 1 ] . node . create_inbound_payment_for_hash ( our_payment_hash, Some ( 100_000 ) , 7200 ) . unwrap ( ) ;
7168
7168
nodes[ 0 ] . node . send_payment ( & route, our_payment_hash, & Some ( our_payment_secret) ) . unwrap ( ) ;
7169
7169
check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
7170
7170
@@ -8018,7 +8018,7 @@ fn test_preimage_storage() {
8018
8018
create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) . 0 . contents . short_channel_id ;
8019
8019
8020
8020
{
8021
- let ( payment_hash, payment_secret) = nodes[ 1 ] . node . create_inbound_payment ( Some ( 100_000 ) , 7200 , 42 ) ;
8021
+ let ( payment_hash, payment_secret) = nodes[ 1 ] . node . create_inbound_payment ( Some ( 100_000 ) , 7200 ) ;
8022
8022
let ( route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 1 ] , 100_000 ) ;
8023
8023
nodes[ 0 ] . node . send_payment ( & route, payment_hash, & Some ( payment_secret) ) . unwrap ( ) ;
8024
8024
check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
@@ -8035,8 +8035,7 @@ fn test_preimage_storage() {
8035
8035
match events[ 0 ] {
8036
8036
Event :: PaymentReceived { ref purpose, .. } => {
8037
8037
match & purpose {
8038
- PaymentPurpose :: InvoicePayment { payment_preimage, user_payment_id, .. } => {
8039
- assert_eq ! ( * user_payment_id, 42 ) ;
8038
+ PaymentPurpose :: InvoicePayment { payment_preimage, .. } => {
8040
8039
claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage. unwrap ( ) ) ;
8041
8040
} ,
8042
8041
_ => panic ! ( "expected PaymentPurpose::InvoicePayment" )
@@ -8056,11 +8055,11 @@ fn test_secret_timeout() {
8056
8055
8057
8056
create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) . 0 . contents . short_channel_id ;
8058
8057
8059
- let ( payment_hash, payment_secret_1) = nodes[ 1 ] . node . create_inbound_payment ( Some ( 100_000 ) , 2 , 0 ) ;
8058
+ let ( payment_hash, payment_secret_1) = nodes[ 1 ] . node . create_inbound_payment ( Some ( 100_000 ) , 2 ) ;
8060
8059
8061
8060
// We should fail to register the same payment hash twice, at least until we've connected a
8062
8061
// block with time 7200 + CHAN_CONFIRM_DEPTH + 1.
8063
- if let Err ( APIError :: APIMisuseError { err } ) = nodes[ 1 ] . node . create_inbound_payment_for_hash ( payment_hash, Some ( 100_000 ) , 2 , 0 ) {
8062
+ if let Err ( APIError :: APIMisuseError { err } ) = nodes[ 1 ] . node . create_inbound_payment_for_hash ( payment_hash, Some ( 100_000 ) , 2 ) {
8064
8063
assert_eq ! ( err, "Duplicate payment hash" ) ;
8065
8064
} else { panic ! ( ) ; }
8066
8065
let mut block = {
@@ -8075,16 +8074,16 @@ fn test_secret_timeout() {
8075
8074
}
8076
8075
} ;
8077
8076
connect_block ( & nodes[ 1 ] , & block) ;
8078
- if let Err ( APIError :: APIMisuseError { err } ) = nodes[ 1 ] . node . create_inbound_payment_for_hash ( payment_hash, Some ( 100_000 ) , 2 , 0 ) {
8077
+ if let Err ( APIError :: APIMisuseError { err } ) = nodes[ 1 ] . node . create_inbound_payment_for_hash ( payment_hash, Some ( 100_000 ) , 2 ) {
8079
8078
assert_eq ! ( err, "Duplicate payment hash" ) ;
8080
8079
} else { panic ! ( ) ; }
8081
8080
8082
8081
// If we then connect the second block, we should be able to register the same payment hash
8083
- // again with a different user_payment_id (this time getting a new payment secret).
8082
+ // again (this time getting a new payment secret).
8084
8083
block. header . prev_blockhash = block. header . block_hash ( ) ;
8085
8084
block. header . time += 1 ;
8086
8085
connect_block ( & nodes[ 1 ] , & block) ;
8087
- let our_payment_secret = nodes[ 1 ] . node . create_inbound_payment_for_hash ( payment_hash, Some ( 100_000 ) , 2 , 42 ) . unwrap ( ) ;
8086
+ let our_payment_secret = nodes[ 1 ] . node . create_inbound_payment_for_hash ( payment_hash, Some ( 100_000 ) , 2 ) . unwrap ( ) ;
8088
8087
assert_ne ! ( payment_secret_1, our_payment_secret) ;
8089
8088
8090
8089
{
@@ -8102,9 +8101,8 @@ fn test_secret_timeout() {
8102
8101
let events = nodes[ 1 ] . node . get_and_clear_pending_events ( ) ;
8103
8102
assert_eq ! ( events. len( ) , 1 ) ;
8104
8103
match events[ 0 ] {
8105
- Event :: PaymentReceived { purpose : PaymentPurpose :: InvoicePayment { payment_preimage, payment_secret, user_payment_id } , .. } => {
8104
+ Event :: PaymentReceived { purpose : PaymentPurpose :: InvoicePayment { payment_preimage, payment_secret } , .. } => {
8106
8105
assert ! ( payment_preimage. is_none( ) ) ;
8107
- assert_eq ! ( user_payment_id, 42 ) ;
8108
8106
assert_eq ! ( payment_secret, our_payment_secret) ;
8109
8107
// We don't actually have the payment preimage with which to claim this payment!
8110
8108
} ,
@@ -8124,7 +8122,7 @@ fn test_bad_secret_hash() {
8124
8122
8125
8123
let random_payment_hash = PaymentHash ( [ 42 ; 32 ] ) ;
8126
8124
let random_payment_secret = PaymentSecret ( [ 43 ; 32 ] ) ;
8127
- let ( our_payment_hash, our_payment_secret) = nodes[ 1 ] . node . create_inbound_payment ( Some ( 100_000 ) , 2 , 0 ) ;
8125
+ let ( our_payment_hash, our_payment_secret) = nodes[ 1 ] . node . create_inbound_payment ( Some ( 100_000 ) , 2 ) ;
8128
8126
let ( route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 1 ] , 100_000 ) ;
8129
8127
8130
8128
// All the below cases should end up being handled exactly identically, so we macro the
0 commit comments