From ba994248ac7f4e4e9e24abb5c654051f81862779 Mon Sep 17 00:00:00 2001 From: Ignotus Peverell Date: Mon, 14 Jan 2019 09:37:34 -0800 Subject: [PATCH] Prevent reward overflow (#2372) * Prevent reward overflow Without this, a miner could cause a crash by including a kernel with an insane fee directly in the block. * Plus and minus, not so similar * Can't be trusted with more code today --- core/src/consensus.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/consensus.rs b/core/src/consensus.rs index 70d5d8c3b..a6d0ef841 100644 --- a/core/src/consensus.rs +++ b/core/src/consensus.rs @@ -43,7 +43,7 @@ pub const REWARD: u64 = BLOCK_TIME_SEC * GRIN_BASE; /// Actual block reward for a given total fee amount pub fn reward(fee: u64) -> u64 { - REWARD + fee + REWARD.saturating_add(fee) } /// Nominal height for standard time intervals, hour is 60 blocks