From b47f6867540f65ebbe655085a50361cdc35cb429 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 20 Aug 2020 13:14:44 +0100 Subject: [PATCH] consensus: Add assertions for Params::HalvingHeight parameters - Height must be non-negative. - Halving index must be positive. --- src/consensus/params.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/consensus/params.cpp b/src/consensus/params.cpp index 48ff3909a..a6525f4b7 100644 --- a/src/consensus/params.cpp +++ b/src/consensus/params.cpp @@ -47,6 +47,9 @@ namespace Consensus { * first halving. */ int Params::HalvingHeight(int nHeight, int halvingIndex) const { + assert(nHeight >= 0); + assert(halvingIndex > 0); + // zip208 // HalvingHeight(i) := max({ height ⦂ N | Halving(height) < i }) + 1 //