This commit is contained in:
Hardhat Chad
2025-08-25 17:04:24 -07:00
parent 60d0f0e876
commit 0a4f463c90
3 changed files with 21 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
use ore_api::prelude::*;
use solana_nostd_keccak::hash;
use solana_program::log::sol_log;
use steel::*;
use crate::whitelist::AUTHORIZED_ACCOUNTS;
@@ -32,6 +33,8 @@ pub fn process_mine(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult
return Err(ProgramError::InvalidAccountData);
}
sol_log(&format!("Authorized account: {}", signer_info.key));
// Generate secure hash with provided nonce.
let mut seed = [0u8; 112];
seed[..8].copy_from_slice(&block.id.to_le_bytes());
@@ -41,6 +44,10 @@ pub fn process_mine(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult
seed[104..].copy_from_slice(&nonce.to_le_bytes());
let h = hash(&seed);
sol_log(&format!("Nonce: {:?}", nonce));
sol_log(&format!("Hashpower: {:?}", miner.hashpower));
sol_log(&format!("Hash: {:?}", h));
// If hash is best hash, update best hash.
if h < block.best_hash {
block.best_hash = h;