From b926e487ffff8196c0d284254cd6520a8282b3b3 Mon Sep 17 00:00:00 2001 From: Hardhat Chad Date: Mon, 11 Aug 2025 12:34:09 -0700 Subject: [PATCH] whitelist for testing --- program/src/mine.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/program/src/mine.rs b/program/src/mine.rs index 94919cb..fdff00f 100644 --- a/program/src/mine.rs +++ b/program/src/mine.rs @@ -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());