diff options
| -rw-r--r-- | examples/mining.rs | 4 | ||||
| -rw-r--r-- | src/handlers.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/examples/mining.rs b/examples/mining.rs index 56e33f3..c95c214 100644 --- a/examples/mining.rs +++ b/examples/mining.rs | |||
| @@ -23,9 +23,9 @@ pub fn main() { | |||
| 23 | 23 | ||
| 24 | let result = Blake2s::digest(&j); | 24 | let result = Blake2s::digest(&j); |
| 25 | 25 | ||
| 26 | let first_five = result[31] as i32 + result[30] as i32 + (result[29] << 4) as i32; | 26 | let first_six = result[31] as i32 + result[30] as i32 + result[29] as i32; |
| 27 | 27 | ||
| 28 | if first_five == 0 { | 28 | if first_six == 0 { |
| 29 | println!("{} - {:x}\n{:?}", nonce, result, b); | 29 | println!("{} - {:x}\n{:?}", nonce, result, b); |
| 30 | break; | 30 | break; |
| 31 | } | 31 | } |
diff --git a/src/handlers.rs b/src/handlers.rs index 6edc96f..38bd459 100644 --- a/src/handlers.rs +++ b/src/handlers.rs | |||
| @@ -137,8 +137,8 @@ pub async fn propose_block(new_block: Block, db: Db) -> Result<impl warp::Reply, | |||
| 137 | let hashvalue = Blake2s::digest(&naked_block_flat); | 137 | let hashvalue = Blake2s::digest(&naked_block_flat); |
| 138 | let hash_string = format!("{:x}", hashvalue); | 138 | let hash_string = format!("{:x}", hashvalue); |
| 139 | 139 | ||
| 140 | // 5 rightmost bits are zero | 140 | // 6 rightmost bits are zero |
| 141 | let should_zero = hashvalue[31] as i32 + hashvalue[30] as i32 + (hashvalue[29] << 4) as i32; | 141 | let should_zero = hashvalue[31] as i32 + hashvalue[30] as i32 + hashvalue[29] as i32; |
| 142 | 142 | ||
| 143 | if should_zero == 0 { | 143 | if should_zero == 0 { |
| 144 | // one last check to see if block is telling the truth | 144 | // one last check to see if block is telling the truth |
