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
This commit is contained in:
Ignotus Peverell 2019-01-14 09:37:34 -08:00 committed by GitHub
parent 5d257283bd
commit ba994248ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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