diff --git a/src/komodo_ccdata.h b/src/komodo_ccdata.h index 32db78283..675420c94 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; int32_t i; + 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; ics_wallet : NULL); //#else - LOCK(cs_main); +// LOCK(cs_main); //#endif proxyType proxy; diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index d3e08a935..4eb2270fb 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -304,6 +304,7 @@ static const CRPCCommand vRPCCommands[] = { "blockchain", "notaries", ¬aries, true }, { "blockchain", "allMoMs", &allMoMs, true }, { "blockchain", "MoMoMdata", &MoMoMdata, true }, + { "blockchain", "calc_MoM", &calc_MoM, true }, { "blockchain", "height_MoM", &height_MoM, true }, { "blockchain", "txMoMproof", &txMoMproof, true }, { "blockchain", "minerids", &minerids, true }, diff --git a/src/rpcserver.h b/src/rpcserver.h index cfc52baf8..ce412cdb9 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -314,6 +314,7 @@ extern UniValue z_validatepaymentdisclosure(const UniValue ¶ms, bool fHelp); extern UniValue allMoMs(const UniValue& params, bool fHelp); extern UniValue MoMoMdata(const UniValue& params, bool fHelp); +extern UniValue calc_MoM(const UniValue& params, bool fHelp); extern UniValue height_MoM(const UniValue& params, bool fHelp); extern UniValue txMoMproof(const UniValue& params, bool fHelp); extern UniValue notaries(const UniValue& params, bool fHelp);