diff --git a/src/komodo_ccdata.h b/src/komodo_ccdata.h index 675420c94..058e38cee 100644 --- a/src/komodo_ccdata.h +++ b/src/komodo_ccdata.h @@ -45,7 +45,9 @@ bits256 iguana_merkle(bits256 *tree,int32_t txn_count) uint256 komodo_calcMoM(int32_t height,int32_t MoMdepth) { static uint256 zero; bits256 MoM,*tree; CBlockIndex *pindex; int32_t i; - tree = (bits256 *)calloc(MoMdepth,sizeof(*tree)); + if ( MoMdepth >= height ) + return(zero); + tree = (bits256 *)calloc(MoMdepth * 3,sizeof(*tree)); for (i=0; i= height ) throw runtime_error("calc_MoM illegal height or MoMdepth\n"); //fprintf(stderr,"height_MoM height.%d\n",height); MoM = komodo_calcMoM(height,MoMdepth);