whitelist for testing

This commit is contained in:
Hardhat Chad
2025-08-11 12:34:09 -07:00
parent 91ca5f14e8
commit b926e487ff

View File

@@ -1,7 +1,13 @@
use ore_api::prelude::*;
use solana_nostd_keccak::hash;
use solana_program::pubkey;
use steel::*;
const AUTHORIZED_ACCOUNTS: [Pubkey; 2] = [
pubkey!("pqspJ298ryBjazPAr95J9sULCVpZe3HbZTWkbC1zrkS"),
pubkey!("6B9PjpHfbhPcSakS5UQ7ZctgbPujfsryVRpDecskGLiz"),
];
/// Mine a block.
pub fn process_mine(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult {
// Parse data.
@@ -25,6 +31,11 @@ pub fn process_mine(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult
.assert_mut(|m| m.block_id == block.id)? // Only allow miner to submit hashes for their current block
.assert_mut(|m| m.hashpower > nonce)?; // Only allow miner to submit nonces for their hashpower range
// Check if the signer is authorized.
if !AUTHORIZED_ACCOUNTS.contains(signer_info.key) {
return Err(ProgramError::InvalidAccountData);
}
// Generate secure hash with provided nonce.
let mut seed = [0u8; 112];
seed[..8].copy_from_slice(&block.id.to_le_bytes());