@@ -1139,7 +1139,7 @@ mod tests {
1139
1139
// Add a few HTLCs to our internal state and assert that balances are as expected. We'll test
1140
1140
// `check_outgoing_addition` in more detail in another test, so we just assert that we can add the htlc in
1141
1141
// this test.
1142
- let hash_1 = PaymentHash { 0 : [ 1 ; 32 ] } ;
1142
+ let hash_1 = PaymentHash ( [ 1 ; 32 ] ) ;
1143
1143
let htlc_1 = Htlc {
1144
1144
amount_msat : 1000 ,
1145
1145
cltv_expiry : 40 ,
@@ -1161,7 +1161,7 @@ mod tests {
1161
1161
) ) ;
1162
1162
1163
1163
// Add a second, distinct htlc to our in-flight state.
1164
- let hash_2 = PaymentHash { 0 : [ 2 ; 32 ] } ;
1164
+ let hash_2 = PaymentHash ( [ 2 ; 32 ] ) ;
1165
1165
let htlc_2 = Htlc {
1166
1166
amount_msat : 1000 ,
1167
1167
cltv_expiry : 40 ,
@@ -1267,7 +1267,7 @@ mod tests {
1267
1267
) ) ;
1268
1268
1269
1269
// Add two large htlcs so that we will start to run into our in-flight total amount limit.
1270
- let hash_1 = PaymentHash { 0 : [ 1 ; 32 ] } ;
1270
+ let hash_1 = PaymentHash ( [ 1 ; 32 ] ) ;
1271
1271
let htlc_1 = Htlc {
1272
1272
amount_msat : channel_state. policy . max_in_flight_msat / 2 ,
1273
1273
cltv_expiry : channel_state. policy . cltv_expiry_delta ,
@@ -1276,7 +1276,7 @@ mod tests {
1276
1276
assert ! ( channel_state. check_outgoing_addition( & htlc_1) . is_ok( ) ) ;
1277
1277
assert ! ( channel_state. add_outgoing_htlc( hash_1, htlc_1) . is_ok( ) ) ;
1278
1278
1279
- let hash_2 = PaymentHash { 0 : [ 2 ; 32 ] } ;
1279
+ let hash_2 = PaymentHash ( [ 2 ; 32 ] ) ;
1280
1280
let htlc_2 = Htlc {
1281
1281
amount_msat : channel_state. policy . max_in_flight_msat / 2 ,
1282
1282
cltv_expiry : channel_state. policy . cltv_expiry_delta ,
@@ -1301,9 +1301,7 @@ mod tests {
1301
1301
1302
1302
// Now we're going to add many htlcs so that we hit our in-flight count limit (unique payment hash per htlc).
1303
1303
for i in 0 ..channel_state. policy . max_htlc_count {
1304
- let hash = PaymentHash {
1305
- 0 : [ i. try_into ( ) . unwrap ( ) ; 32 ] ,
1306
- } ;
1304
+ let hash = PaymentHash ( [ i. try_into ( ) . unwrap ( ) ; 32 ] ) ;
1307
1305
assert ! ( channel_state. check_outgoing_addition( & htlc) . is_ok( ) ) ;
1308
1306
assert ! ( channel_state. add_outgoing_htlc( hash, htlc) . is_ok( ) ) ;
1309
1307
}
@@ -1321,15 +1319,13 @@ mod tests {
1321
1319
1322
1320
// Resolve all in-flight htlcs.
1323
1321
for i in 0 ..channel_state. policy . max_htlc_count {
1324
- let hash = PaymentHash {
1325
- 0 : [ i. try_into ( ) . unwrap ( ) ; 32 ] ,
1326
- } ;
1322
+ let hash = PaymentHash ( [ i. try_into ( ) . unwrap ( ) ; 32 ] ) ;
1327
1323
assert ! ( channel_state. remove_outgoing_htlc( & hash) . is_ok( ) ) ;
1328
1324
channel_state. settle_outgoing_htlc ( htlc. amount_msat , true )
1329
1325
}
1330
1326
1331
1327
// Add and settle another htlc to move more liquidity away from our local balance.
1332
- let hash_4 = PaymentHash { 0 : [ 1 ; 32 ] } ;
1328
+ let hash_4 = PaymentHash ( [ 1 ; 32 ] ) ;
1333
1329
let htlc_4 = Htlc {
1334
1330
amount_msat : channel_state. policy . max_htlc_size_msat ,
1335
1331
cltv_expiry : channel_state. policy . cltv_expiry_delta ,
@@ -1367,7 +1363,7 @@ mod tests {
1367
1363
} ;
1368
1364
1369
1365
// Assert that we're not able to send a htlc over node_2 -> node_1 (no liquidity).
1370
- let hash_1 = PaymentHash { 0 : [ 1 ; 32 ] } ;
1366
+ let hash_1 = PaymentHash ( [ 1 ; 32 ] ) ;
1371
1367
let htlc_1 = Htlc {
1372
1368
amount_msat : node_2. policy . min_htlc_size_msat ,
1373
1369
cltv_expiry : node_1. policy . cltv_expiry_delta ,
@@ -1379,7 +1375,7 @@ mod tests {
1379
1375
) ) ;
1380
1376
1381
1377
// Assert that we can send a htlc over node_1 -> node_2.
1382
- let hash_2 = PaymentHash { 0 : [ 1 ; 32 ] } ;
1378
+ let hash_2 = PaymentHash ( [ 1 ; 32 ] ) ;
1383
1379
let htlc_2 = Htlc {
1384
1380
amount_msat : node_1. policy . max_htlc_size_msat ,
1385
1381
cltv_expiry : node_2. policy . cltv_expiry_delta ,
@@ -1484,7 +1480,7 @@ mod tests {
1484
1480
panic ! ( "unknown mocked receiver" ) ;
1485
1481
} ;
1486
1482
1487
- let _ = sender. send ( Ok ( result) ) . unwrap ( ) ;
1483
+ sender. send ( Ok ( result) ) . unwrap ( ) ;
1488
1484
} ,
1489
1485
) ;
1490
1486
@@ -1589,7 +1585,7 @@ mod tests {
1589
1585
1590
1586
let ( sender, receiver) = oneshot:: channel ( ) ;
1591
1587
self . graph
1592
- . dispatch_payment ( source, route. clone ( ) , PaymentHash { 0 : [ 1 ; 32 ] } , sender) ;
1588
+ . dispatch_payment ( source, route. clone ( ) , PaymentHash ( [ 1 ; 32 ] ) , sender) ;
1593
1589
1594
1590
// Assert that we receive from the channel or fail.
1595
1591
assert ! ( timeout( Duration :: from_millis( 10 ) , receiver) . await . is_ok( ) ) ;
0 commit comments