From 91ca5f14e851aa0a6be93d10bb6e22c704548f49 Mon Sep 17 00:00:00 2001 From: Hardhat Chad Date: Wed, 6 Aug 2025 11:43:16 -0700 Subject: [PATCH] miner --- program/src/close.rs | 4 ++-- program/src/mine.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/program/src/close.rs b/program/src/close.rs index 2363e57..4844200 100644 --- a/program/src/close.rs +++ b/program/src/close.rs @@ -46,8 +46,8 @@ pub fn process_close(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul if block.best_hash_miner != Pubkey::default() { // Load winning miner. let miner = miner_info - .has_address(&block.best_hash_miner)? - .as_account_mut::(&ore_api::ID)?; + .as_account_mut::(&ore_api::ID)? + .assert_mut(|m| m.authority == block.best_hash_miner)?; // Update stats. miner.total_rewards += block.reward; diff --git a/program/src/mine.rs b/program/src/mine.rs index 8e2f7ac..94919cb 100644 --- a/program/src/mine.rs +++ b/program/src/mine.rs @@ -37,7 +37,7 @@ pub fn process_mine(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult // If hash is best hash, update best hash. if h < block.best_hash { block.best_hash = h; - block.best_hash_miner = *miner_info.key; + block.best_hash_miner = miner.authority; } // Only allow miners to submit 1 hash per block.