|
|
@@ -126,7 +126,7 @@ pub fn header_rank(header: &Header, target: &BigUint) -> Result<(BigUint, BigUin
|
|
|
|
|
|
// Compute the output hash
|
|
|
let out_hash = vm.calculate_hash(header.hash().inner())?;
|
|
|
- let out_hash = BigUint::from_bytes_be(&out_hash);
|
|
|
+ let out_hash = BigUint::from_bytes_le(&out_hash);
|
|
|
|
|
|
// Verify hash is less than the expected mine target
|
|
|
if out_hash > *target {
|
|
|
@@ -134,7 +134,7 @@ pub fn header_rank(header: &Header, target: &BigUint) -> Result<(BigUint, BigUin
|
|
|
}
|
|
|
|
|
|
// Grab the max 32 bytes int
|
|
|
- let max = BigUint::from_bytes_be(&[0xFF; 32]);
|
|
|
+ let max = BigUint::from_bytes_le(&[0xFF; 32]);
|
|
|
|
|
|
// Compute the squared mining target distance
|
|
|
let target_distance = &max - target;
|
|
|
@@ -159,7 +159,7 @@ pub fn block_rank(block: &BlockInfo, target: &BigUint) -> Result<(BigUint, BigUi
|
|
|
}
|
|
|
|
|
|
// Grab the max 32 bytes int
|
|
|
- let max = BigUint::from_bytes_be(&[0xFF; 32]);
|
|
|
+ let max = BigUint::from_bytes_le(&[0xFF; 32]);
|
|
|
|
|
|
// Compute the squared mining target distance
|
|
|
let target_distance = &max - target;
|
|
|
@@ -172,7 +172,7 @@ pub fn block_rank(block: &BlockInfo, target: &BigUint) -> Result<(BigUint, BigUi
|
|
|
|
|
|
// Compute the output hash distance
|
|
|
let out_hash = vm.calculate_hash(block.hash().inner())?;
|
|
|
- let out_hash = BigUint::from_bytes_be(&out_hash);
|
|
|
+ let out_hash = BigUint::from_bytes_le(&out_hash);
|
|
|
let hash_distance = max - out_hash;
|
|
|
let hash_distance_sq = &hash_distance * &hash_distance;
|
|
|
|