@@ -1472,7 +1472,9 @@ mod tests {
1472
1472
// 0 hashes
1473
1473
let mut file = AccountHashesFile :: new ( 0 , dir_for_temp_cache_files. path ( ) ) ;
1474
1474
assert ! ( file. get_reader( ) . is_none( ) ) ;
1475
- let hashes = ( 0 ..2 ) . map ( |i| Hash :: new ( & [ i; 32 ] ) ) . collect :: < Vec < _ > > ( ) ;
1475
+ let hashes = ( 0 ..2 )
1476
+ . map ( |i| Hash :: new_from_array ( [ i; 32 ] ) )
1477
+ . collect :: < Vec < _ > > ( ) ;
1476
1478
1477
1479
// 1 hash
1478
1480
let mut file = AccountHashesFile :: new ( 1 , dir_for_temp_cache_files. path ( ) ) ;
@@ -1493,7 +1495,9 @@ mod tests {
1493
1495
fn test_cumulative_hashes_from_files ( ) {
1494
1496
let dir_for_temp_cache_files = tempdir ( ) . unwrap ( ) ;
1495
1497
( 0 ..4 ) . for_each ( |permutation| {
1496
- let hashes = ( 0 ..2 ) . map ( |i| Hash :: new ( & [ i + 1 ; 32 ] ) ) . collect :: < Vec < _ > > ( ) ;
1498
+ let hashes = ( 0 ..2 )
1499
+ . map ( |i| Hash :: new_from_array ( [ i + 1 ; 32 ] ) )
1500
+ . collect :: < Vec < _ > > ( ) ;
1497
1501
1498
1502
let mut combined = Vec :: default ( ) ;
1499
1503
@@ -1585,7 +1589,7 @@ mod tests {
1585
1589
let mut account_maps = Vec :: new ( ) ;
1586
1590
1587
1591
let pubkey = Pubkey :: from ( [ 11u8 ; 32 ] ) ;
1588
- let hash = AccountHash ( Hash :: new ( & [ 1u8 ; 32 ] ) ) ;
1592
+ let hash = AccountHash ( Hash :: new_from_array ( [ 1u8 ; 32 ] ) ) ;
1589
1593
let val = CalculateHashIntermediate {
1590
1594
hash,
1591
1595
lamports : 88 ,
@@ -1595,7 +1599,7 @@ mod tests {
1595
1599
1596
1600
// 2nd key - zero lamports, so will be removed
1597
1601
let pubkey = Pubkey :: from ( [ 12u8 ; 32 ] ) ;
1598
- let hash = AccountHash ( Hash :: new ( & [ 2u8 ; 32 ] ) ) ;
1602
+ let hash = AccountHash ( Hash :: new_from_array ( [ 2u8 ; 32 ] ) ) ;
1599
1603
let val = CalculateHashIntermediate {
1600
1604
hash,
1601
1605
lamports : 0 ,
@@ -1615,7 +1619,7 @@ mod tests {
1615
1619
1616
1620
// 3rd key - with pubkey value before 1st key so it will be sorted first
1617
1621
let pubkey = Pubkey :: from ( [ 10u8 ; 32 ] ) ;
1618
- let hash = AccountHash ( Hash :: new ( & [ 2u8 ; 32 ] ) ) ;
1622
+ let hash = AccountHash ( Hash :: new_from_array ( [ 2u8 ; 32 ] ) ) ;
1619
1623
let val = CalculateHashIntermediate {
1620
1624
hash,
1621
1625
lamports : 20 ,
@@ -1633,7 +1637,7 @@ mod tests {
1633
1637
1634
1638
// 3rd key - with later slot
1635
1639
let pubkey = Pubkey :: from ( [ 10u8 ; 32 ] ) ;
1636
- let hash = AccountHash ( Hash :: new ( & [ 99u8 ; 32 ] ) ) ;
1640
+ let hash = AccountHash ( Hash :: new_from_array ( [ 99u8 ; 32 ] ) ) ;
1637
1641
let val = CalculateHashIntermediate {
1638
1642
hash,
1639
1643
lamports : 30 ,
@@ -1729,7 +1733,7 @@ mod tests {
1729
1733
let key_b = Pubkey :: from ( [ 2u8 ; 32 ] ) ;
1730
1734
let key_c = Pubkey :: from ( [ 3u8 ; 32 ] ) ;
1731
1735
const COUNT : usize = 6 ;
1732
- let hashes = ( 0 ..COUNT ) . map ( |i| AccountHash ( Hash :: new ( & [ i as u8 ; 32 ] ) ) ) ;
1736
+ let hashes = ( 0 ..COUNT ) . map ( |i| AccountHash ( Hash :: new_from_array ( [ i as u8 ; 32 ] ) ) ) ;
1733
1737
// create this vector
1734
1738
// abbbcc
1735
1739
let keys = [ key_a, key_b, key_b, key_b, key_c, key_c] ;
@@ -2392,7 +2396,8 @@ mod tests {
2392
2396
let mut input: Vec < _ > = ( 0 ..count)
2393
2397
. map ( |i| {
2394
2398
let key = Pubkey :: from ( [ ( pass * iterations + count) as u8 ; 32 ] ) ;
2395
- let hash = Hash :: new ( & [ ( pass * iterations + count + i + 1 ) as u8 ; 32 ] ) ;
2399
+ let hash =
2400
+ Hash :: new_from_array ( [ ( pass * iterations + count + i + 1 ) as u8 ; 32 ] ) ;
2396
2401
( key, hash)
2397
2402
} )
2398
2403
. collect ( ) ;
@@ -2436,12 +2441,12 @@ mod tests {
2436
2441
let offset = 2 ;
2437
2442
let input = vec ! [
2438
2443
CalculateHashIntermediate {
2439
- hash: AccountHash ( Hash :: new ( & [ 1u8 ; 32 ] ) ) ,
2444
+ hash: AccountHash ( Hash :: new_from_array ( [ 1u8 ; 32 ] ) ) ,
2440
2445
lamports: u64 :: MAX - offset,
2441
2446
pubkey: Pubkey :: new_unique( ) ,
2442
2447
} ,
2443
2448
CalculateHashIntermediate {
2444
- hash: AccountHash ( Hash :: new ( & [ 2u8 ; 32 ] ) ) ,
2449
+ hash: AccountHash ( Hash :: new_from_array ( [ 2u8 ; 32 ] ) ) ,
2445
2450
lamports: offset + 1 ,
2446
2451
pubkey: Pubkey :: new_unique( ) ,
2447
2452
} ,
@@ -2470,12 +2475,12 @@ mod tests {
2470
2475
let offset = 2 ;
2471
2476
let input = vec ! [
2472
2477
vec![ CalculateHashIntermediate {
2473
- hash: AccountHash ( Hash :: new ( & [ 1u8 ; 32 ] ) ) ,
2478
+ hash: AccountHash ( Hash :: new_from_array ( [ 1u8 ; 32 ] ) ) ,
2474
2479
lamports: u64 :: MAX - offset,
2475
2480
pubkey: Pubkey :: new_unique( ) ,
2476
2481
} ] ,
2477
2482
vec![ CalculateHashIntermediate {
2478
- hash: AccountHash ( Hash :: new ( & [ 2u8 ; 32 ] ) ) ,
2483
+ hash: AccountHash ( Hash :: new_from_array ( [ 2u8 ; 32 ] ) ) ,
2479
2484
lamports: offset + 1 ,
2480
2485
pubkey: Pubkey :: new_unique( ) ,
2481
2486
} ] ,
0 commit comments