From b0fa5bad4d808abfc7f6239279ff0da0863a8f7f Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 27 Apr 2018 13:16:37 +0300 Subject: [PATCH 1/3] calc_MoM --- src/komodo_ccdata.h | 21 ++++++++++++++++++++- src/rpcblockchain.cpp | 20 ++++++++++++++++++++ src/rpcserver.cpp | 1 + src/rpcserver.h | 1 + 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/komodo_ccdata.h b/src/komodo_ccdata.h index 32db78283..545c8b87a 100644 --- a/src/komodo_ccdata.h +++ b/src/komodo_ccdata.h @@ -42,6 +42,25 @@ bits256 iguana_merkle(bits256 *tree,int32_t txn_count) return(tree[n]); } +uint256 komodo_calcMoM(int32_t height,int32_t MoMdepth) +{ + static uint256 zero; bits256 MoM,*tree; CBlockIndex *pindex; + tree = (bits256 *)calloc(MoMdepth,sizeof(*tree)); + for (i=0; ihashMerkleRoot,sizeof(bits256)); + else + { + free(tree); + return(zero); + } + } + MoM = iguana_merkle(tree,MoMdepth); + free(tree); + return(*(uint256 *)&MoM); +} + struct komodo_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmdstarti,int32_t kmdendi) { struct komodo_ccdata_entry *allMoMs=0; bits256 *tree,tmp; struct komodo_ccdata *ccdata,*tmpptr; int32_t i,num,max; @@ -73,7 +92,7 @@ struct komodo_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t for (i=0; i Date: Fri, 27 Apr 2018 13:17:48 +0300 Subject: [PATCH 2/3] syntax --- src/komodo_ccdata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_ccdata.h b/src/komodo_ccdata.h index 545c8b87a..675420c94 100644 --- a/src/komodo_ccdata.h +++ b/src/komodo_ccdata.h @@ -44,7 +44,7 @@ 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; + static uint256 zero; bits256 MoM,*tree; CBlockIndex *pindex; int32_t i; tree = (bits256 *)calloc(MoMdepth,sizeof(*tree)); for (i=0; i Date: Fri, 27 Apr 2018 13:19:33 +0300 Subject: [PATCH 3/3] -LOCK cs_main --- src/rpcmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 0a413d52c..079354a7b 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -92,7 +92,7 @@ UniValue getinfo(const UniValue& params, bool fHelp) //#ifdef ENABLE_WALLET // LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL); //#else - LOCK(cs_main); +// LOCK(cs_main); //#endif proxyType proxy;