From cba2c748e21c8ef0d486b5b22e1e1cf405d3b2a2 Mon Sep 17 00:00:00 2001 From: Hardhat Chad Date: Mon, 26 Feb 2024 16:25:44 +0000 Subject: [PATCH] le_bytes --- src/processor/mine.rs | 6 +++--- tests/test_mine.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/processor/mine.rs b/src/processor/mine.rs index b9b4fc3..44c7df9 100644 --- a/src/processor/mine.rs +++ b/src/processor/mine.rs @@ -97,7 +97,7 @@ pub(crate) fn validate_hash( let hash_ = hashv(&[ current_hash.as_ref(), signer.as_ref(), - nonce.to_be_bytes().as_slice(), + nonce.to_le_bytes().as_slice(), ]); if sol_memcmp(hash.as_ref(), hash_.as_ref(), 32) != 0 { return Err(OreError::InvalidHash.into()); @@ -129,7 +129,7 @@ mod tests { let h2 = hashv(&[ h1.to_bytes().as_slice(), signer.to_bytes().as_slice(), - nonce.to_be_bytes().as_slice(), + nonce.to_le_bytes().as_slice(), ]); let res = validate_hash(h1, h2, signer, nonce, difficulty); assert!(res.is_ok()); @@ -155,7 +155,7 @@ mod tests { let h2 = hashv(&[ h1.to_bytes().as_slice(), signer.to_bytes().as_slice(), - nonce.to_be_bytes().as_slice(), + nonce.to_le_bytes().as_slice(), ]); let res = validate_hash(h1, h2, signer, nonce, difficulty); assert!(res.is_err()); diff --git a/tests/test_mine.rs b/tests/test_mine.rs index d9f5bc0..452d53f 100644 --- a/tests/test_mine.rs +++ b/tests/test_mine.rs @@ -133,7 +133,7 @@ fn find_next_hash(hash: KeccakHash, difficulty: KeccakHash, signer: Pubkey) -> ( next_hash = hashv(&[ hash.to_bytes().as_slice(), signer.to_bytes().as_slice(), - nonce.to_be_bytes().as_slice(), + nonce.to_le_bytes().as_slice(), ]); if next_hash.le(&difficulty) { break;