mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 07:26:51 +00:00
whitelist for testing
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user