From cbe63c0d7d57162bef89197a237f5600d6b5828a Mon Sep 17 00:00:00 2001 From: Hardhat Chad Date: Mon, 20 Jan 2025 09:38:12 -0800 Subject: [PATCH] mining reward checksum --- program/src/mine.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/program/src/mine.rs b/program/src/mine.rs index ec001fb..4f4860a 100644 --- a/program/src/mine.rs +++ b/program/src/mine.rs @@ -169,6 +169,16 @@ pub fn process_mine(accounts: &[AccountInfo], data: &[u8]) -> ProgramResult { let net_miner_boost_reward = net_boost_reward.checked_sub(net_staker_boost_reward).unwrap(); let net_miner_reward = net_base_reward.checked_add(net_miner_boost_reward).unwrap(); + // Checksum on rewards + assert!( + net_reward == net_base_reward + .checked_add(net_miner_boost_reward) + .unwrap() + .checked_add(net_staker_boost_reward) + .unwrap(), + "Rewards checksum failed" + ); + // Update bus balances. // // We track the theoretical rewards that would have been paid out ignoring the bus limit, so the