MoMoM code complete

This commit is contained in:
jl777
2018-04-12 14:41:39 +03:00
parent 9973e12ebb
commit 51dab14914
7 changed files with 163 additions and 76 deletions

View File

@@ -641,13 +641,14 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
if ( ASSETCHAINS_SYMBOL[0] != 0 )
{
// MoMoM, depth, numpairs, (notarization ht, MoMoM offset)
if ( len+44-opoffset <= opretlen && strcmp(ccdata.symbol,ASSETCHAINS_SYMBOL) == 0 )
if ( len+48-opoffset <= opretlen && strcmp(ccdata.symbol,ASSETCHAINS_SYMBOL) == 0 )
{
len += iguana_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.MoMoMstarti);
len += iguana_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.MoMoMendi);
len += iguana_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.kmdstarti);
len += iguana_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.kmdendi);
len += iguana_rwbignum(0,&scriptbuf[len],sizeof(MoMoMdata.MoMoM),(uint8_t *)&MoMoMdata.MoMoM);
len += iguana_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.MoMoMdepth);
len += iguana_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.numpairs);
MoMoMdata.len += sizeof(MoMoMdata.MoMoM) + sizeof(uint32_t)*3;
MoMoMdata.len += sizeof(MoMoMdata.MoMoM) + sizeof(uint32_t)*4;
if ( len+MoMoMdata.numpairs*8-opoffset == opretlen )
{
MoMoMdata.pairs = (struct komodo_ccdatapair *)calloc(MoMoMdata.numpairs,sizeof(*MoMoMdata.pairs));

View File

@@ -869,10 +869,10 @@ int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp
return(0);
}
int32_t komodo_MoM(int32_t *notarized_heightp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight)
int32_t komodo_MoM(int32_t *notarized_heightp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip)
{
int32_t depth,notarized_ht; uint256 MoM,kmdtxid;
depth = komodo_MoMdata(&notarized_ht,&MoM,&kmdtxid,nHeight);
depth = komodo_MoMdata(&notarized_ht,&MoM,&kmdtxid,nHeight,MoMoMp,MoMoMoffsetp,MoMoMdepthp,kmdstartip,kmdendip);
memset(MoMp,0,sizeof(*MoMp));
memset(kmdtxidp,0,sizeof(*kmdtxidp));
*notarized_heightp = 0;

View File

@@ -16,31 +16,8 @@
#ifndef H_KOMODOCCDATA_H
#define H_KOMODOCCDATA_H
/*
struct komodo_ccdataMoM
{
uint256 MoM;
int32_t MoMdepth,notarized_height,height,txi;
};
struct komodo_ccdatapair { int32_t notarization_height; uint32_t MoMoMoffset; };
struct komodo_ccdataMoMoM
{
uint256 MoMoM;
int32_t MoMoMstarti,MoMoMendi,numpairs,len;
struct komodo_ccdatapair *pairs;
};
struct komodo_ccdata
{
struct komodo_ccdataMoM MoMdata;
uint32_t CCid,len,inMoMoM;
char symbol[65];
};
*/
struct komodo_ccdata *CC_data;
int32_t CC_firstheight;
bits256 iguana_merkle(bits256 *tree,int32_t txn_count)
{
@@ -65,11 +42,18 @@ bits256 iguana_merkle(bits256 *tree,int32_t txn_count)
return(tree[n]);
}
char *komodo_MoMoMdata(char *symbol,int32_t kmdheight,int32_t notarized_height)
int32_t komodo_MoMoMdata(char *hexstr,int32_t hexsize,struct komodo_ccdataMoMoM *mdata,char *symbol,int32_t kmdheight,int32_t notarized_height)
{
cJSON *retjson,*pairs,*item; struct komodo_ccdata *ccdata,*tmp; int32_t max,offset,starti,endi,kmdstarti=0; bits256 *tree=0,MoMoM;
starti = endi = offset = max = 0;
cJSON *retjson,*pairs,*item; uint8_t hexdata[8192]; struct komodo_ccdata *ccdata,*tmp; int32_t len,i,retval=-1,max,offset,starti,endi,kmdstarti=0; bits256 *tree=0,MoMoM;
starti = endi = offset = max = len = 0;
hexstr[0] = 0;
if ( sizeof(hexdata)*2+1 > hexsize )
{
fprintf(stderr,"hexsize.%d too small for %d\n",hexsize,(int32_t)sizeof(hexdata));
return(-1);
}
pairs = cJSON_CreateArray();
memset(mdata,0,sizeof(*mdata));
portable_mutex_lock(&KOMODO_CC_mutex);
DL_FOREACH_SAFE(CC_data,ccdata,tmp)
{
@@ -79,8 +63,11 @@ char *komodo_MoMoMdata(char *symbol,int32_t kmdheight,int32_t notarized_height)
if ( strcmp(ccdata->symbol,symbol) == 0 )
{
if ( endi == 0 )
{
len += iguana_rwnum(1,&hexdata[len],sizeof(ccdata->CCid),(uint8_t *)&ccdata->CCid);
endi = ccdata->MoMdata.height;
if (ccdata->MoMdata.notarized_height <= notarized_height )
}
if ( (mdata.numpairs == 1 && notarized_height == 0) || ccdata->MoMdata.notarized_height <= notarized_height )
{
starti = ccdata->MoMdata.height + 1;
break;
@@ -89,12 +76,13 @@ char *komodo_MoMoMdata(char *symbol,int32_t kmdheight,int32_t notarized_height)
jaddinum(item,ccdata->MoMdata.notarized_height);
jaddinum(item,offset);
jaddi(pairs,item);
mdata.numpairs++;
}
if ( offset >= max )
{
max += 100;
tree = (bits256 *)realloc(tree,sizeof(*tree)*max);
fprintf(stderr,"tree reallocated to %p max.%d\n",tree,max);
//fprintf(stderr,"tree reallocated to %p max.%d\n",tree,max);
}
memcpy(&tree[offset++],&ccdata->MoMdata.MoM,sizeof(bits256));
starti = ccdata->MoMdata.height;
@@ -110,38 +98,98 @@ char *komodo_MoMoMdata(char *symbol,int32_t kmdheight,int32_t notarized_height)
{
MoMoM = iguana_merkle(tree,offset);
jaddbits256(retjson,(char *)"MoMoM",MoMoM);
jaddnum(retjson,(char *)"MoMoMdepth",offset);
if ( mdata.numpairs > 0 && mdata.numpairs == cJSON_GetArraySize(pairs) )
{
len += iguana_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->kmdstarti);
len += iguana_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->kmdendi);
len += iguana_rwbignum(1,&hexdata[len],sizeof(mdata->MoMoM),(uint8_t *)&mdata->MoMoM);
len += iguana_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->MoMoMdepth);
len += iguana_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata->numpairs);
mdata.pairs = (struct komodo_ccdatapair *)calloc(mdata.numpairs,sizeof(*mdata.pairs));
for (i=0; i<mdata.numpairs; i++)
{
if ( len + sizeof(uint32_t)*2 > sizeof(hexdata) )
{
fprintf(stderr,"%s %d %d i.%d of %d exceeds hexdata.%d\n",symbol,kmdheight,notarized_height,i,mdata.numpairs,(int32_t)sizeof(hexdata));
break;
}
item = jitem(pairs,i);
mdata.pairs[i].notarization_height = juint(0,jitem(item,0));
mdata.pairs[i].MoMoMoffset = juint(0,jitem(item,1));
len += iguana_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata.pairs[i].notarization_height);
len += iguana_rwnum(1,&hexdata[len],sizeof(uint32_t),(uint8_t *)&mdata.pairs[i].MoMoMoffset);
}
if ( i == mdata.numpairs && len*2+1 < hexsize )
{
init_hexbyte_noT(hexstr,hexdata,len);
retval = 0;
} else fprintf(stderr,"%s %d %d too much hexdata[%d] for hexstr[%d]\n",symbol,kmdheight,notarized_height,len,hexsize);
}
}
}
if ( tree != 0 )
{
fprintf(stderr,"free tree.%p\n",tree);
free(tree);
}
jadd(retjson,(char *)"offsets",pairs);
fprintf(stderr,"%s\n",jprint(retjson,0));
return(jprint(retjson,1));
return(retval);
}
int32_t komodo_rwccdata(char *thischain,int32_t rwflag,struct komodo_ccdata *ccdata,struct komodo_ccdataMoMoM *MoMoMdata)
{
bits256 hash; int32_t i; struct komodo_ccdata *ptr;
bits256 hash; int32_t i; struct komodo_ccdata *ptr; struct notarized_checkpoint *np;
if ( rwflag == 0 )
{
// load from disk
}
else
{
// write to disk
}
if ( ccdata->MoMdata.height > 0 && (CC_firstheight == 0 || ccdata->MoMdata.height < CC_firstheight) )
CC_firstheight = ccdata->MoMdata.height;
for (i=0; i<32; i++)
hash.bytes[i] = ((uint8_t *)&ccdata->MoMdata.MoM)[31-i];
char str[65]; fprintf(stderr,"[%s] ccdata.%s id.%d notarized_ht.%d MoM.%s height.%d/t%d\n",ASSETCHAINS_SYMBOL,ccdata->symbol,ccdata->CCid,ccdata->MoMdata.notarized_height,bits256_str(str,hash),ccdata->MoMdata.height,ccdata->MoMdata.txi);
if ( ASSETCHAINS_SYMBOL[0] == 0 )
{
ptr = (struct komodo_ccdata *)calloc(1,sizeof(*ptr));
*ptr = *ccdata;
portable_mutex_lock(&KOMODO_CC_mutex);
DL_PREPEND(CC_data,ptr);
portable_mutex_unlock(&KOMODO_CC_mutex);
if ( CC_data != 0 && (CC_data->MoMdata.height > ccdata->MoMdata.height || (CC_data->MoMdata.height == ccdata->MoMdata.height && CC_data->MoMdata.txi >= ccdata->MoMdata.txi)) )
{
printf("out of order detected? SKIP CC_data ht.%d/txi.%d vs ht.%d/txi.%d\n",CC_data->MoMdata.height,CC_data->MoMdata.txi,ccdata->MoMdata.height,ccdata->MoMdata.txi);
}
else
{
ptr = (struct komodo_ccdata *)calloc(1,sizeof(*ptr));
*ptr = *ccdata;
portable_mutex_lock(&KOMODO_CC_mutex);
DL_PREPEND(CC_data,ptr);
portable_mutex_unlock(&KOMODO_CC_mutex);
}
}
else
{
if ( MoMoMdata != 0 && MoMoMdata->pairs != 0 )
{
for (i=0; i<MoMoMdata->numpairs; i++)
{
if ( (np= komodo_npptr(MoMoMdata->pairs[i].notarized_height)) != 0 )
{
if ( bits256_nonz(np->MoMoM) == 0 )
{
np->MoMoM = MoMoMdata->MoMoM;
np->MoMoMdepth = MoMoMdata->MoMoMdepth;
np->MoMoMoffset = MoMoMdata->MoMoMoffset;
np->kmdstarti = MoMoMdata->kmdstarti;
np->kmdendi = MoMoMdata->kmdendi;
}
else if ( bits256_cmp(np->MoMoM,MoMoMdata->MoMoM) != 0 || np->MoMoMdepth != MoMoMdata->MoMoMdepth || np->MoMoMoffset != MoMoMdata->MoMoMoffset || np->kmdstarti != MoMoMdata->kmdstarti || np->kmdendi != MoMoMdata->kmdendi )
{
char str[65],str2[65];
fprintf(stderr,"preexisting MoMoM mismatch: %s (%d %d %d %d) vs %s (%d %d %d %d)\n",bits256_str(str,np->MoMoM),np->MoMoMdepth,np->MoMoMoffset,np->kmdstarti,np->kmdendi,bits256_str(str2,MoMoMdata->MoMoM),,MoMoMdata->MoMoMdepth,MoMoMdata->MoMoMoffset,MoMoMdata->kmdstarti,MoMoMdata->kmdendi);
}
}
}
}
}
}

View File

@@ -18,7 +18,7 @@
uint32_t komodo_heightstamp(int32_t height);
void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t kheight,uint32_t ktime,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth);
void komodo_init(int32_t height);
int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight);
int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip);
int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp);
char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port);
void komodo_init(int32_t height);

View File

@@ -396,27 +396,39 @@ int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp)
}
}
int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t height)
struct notarized_checkpoint *komodo_npptr(int32_t height)
{
int32_t i; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; struct notarized_checkpoint *np = 0;
np = 0;
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0;
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
{
for (i=sp->NUM_NPOINTS-1; i>=0; i--)
{
np = &sp->NPOINTS[i];
if ( np->MoMdepth > 0 && height > np->notarized_height-np->MoMdepth && height <= np->notarized_height )
{
*notarized_htp = np->notarized_height;
*MoMp = np->MoM;
*kmdtxidp = np->notarized_desttxid;
return(np->MoMdepth);
}
return(np);
}
}
*notarized_htp = 0;
return(0);
}
int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip)
{
struct notarized_checkpoint *np = 0;
if ( (np= komodo_npptr(height)) != 0 )
{
*notarized_htp = np->notarized_height;
*MoMp = np->MoM;
*kmdtxidp = np->notarized_desttxid;
*MoMoMp = np->MoMoM;
*MoMoMoffsetp = np->MoMoMoffset;
*MoMoMdepthp = np->MoMoMdepth;
*kmdstartip = np->kmdstarti;
*kmdendip = np->kmdendip;
return(np->MoMdepth);
}
*notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *kmdstartip = *kmdendip = 0;
memset(MoMp,0,sizeof(*MoMp));
memset(MoMoMp,0,sizeof(*MoMoMp));
memset(kmdtxidp,0,sizeof(*kmdtxidp));
return(0);
}

View File

@@ -85,8 +85,8 @@ struct knotary_entry { UT_hash_handle hh; uint8_t pubkey[33],notaryid; };
struct knotaries_entry { int32_t height,numnotaries; struct knotary_entry *Notaries; };
struct notarized_checkpoint
{
uint256 notarized_hash,notarized_desttxid,MoM;
int32_t nHeight,notarized_height,MoMdepth;
uint256 notarized_hash,notarized_desttxid,MoM,MoMoM;
int32_t nHeight,notarized_height,MoMdepth,MoMoMdepth,MoMoMoffset,kmdstarti,kmdendi;
};
struct komodo_ccdataMoM
@@ -100,7 +100,7 @@ struct komodo_ccdatapair { int32_t notarization_height; uint32_t MoMoMoffset; };
struct komodo_ccdataMoMoM
{
uint256 MoMoM;
int32_t MoMoMstarti,MoMoMendi,numpairs,len;
int32_t kmdstarti,kmdendi,MoMoMdepth,numpairs,len;
struct komodo_ccdatapair *pairs;
};
@@ -108,7 +108,7 @@ struct komodo_ccdata
{
struct komodo_ccdata *next,*prev;
struct komodo_ccdataMoM MoMdata;
uint32_t CCid,inMoMoM,len;
uint32_t CCid,len;
char symbol[65];
};

View File

@@ -539,6 +539,7 @@ UniValue gettxoutsetinfo(const UniValue& params, bool fHelp)
}
#include "komodo_defs.h"
#include "komodo_structs.h"
#define IGUANA_MAXSCRIPTSIZE 10001
#define KOMODO_KVDURATION 1440
@@ -552,8 +553,8 @@ char *bitcoin_address(char *coinaddr,uint8_t addrtype,uint8_t *pubkey_or_rmd160,
//uint32_t komodo_interest_args(int32_t *txheightp,uint32_t *tiptimep,uint64_t *valuep,uint256 hash,int32_t n);
int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width);
int32_t komodo_kvsearch(uint256 *refpubkeyp,int32_t current_height,uint32_t *flagsp,int32_t *heightp,uint8_t value[IGUANA_MAXSCRIPTSIZE],uint8_t *key,int32_t keylen);
int32_t komodo_MoM(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight);
char *komodo_MoMoMdata(char *symbol,int32_t kmdheight,int32_t notarized_height);
int32_t komodo_MoM(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip);
int32_t komodo_MoMoMdata(char *hexstr,int32_t hexsize,struct komodo_ccdataMoMoM *mdata,char *symbol,int32_t kmdheight,int32_t notarized_height);
UniValue kvsearch(const UniValue& params, bool fHelp)
{
@@ -592,26 +593,43 @@ UniValue kvsearch(const UniValue& params, bool fHelp)
UniValue MoMoMdata(const UniValue& params, bool fHelp)
{
char *symbol,*retstr; int32_t kmdheight,notarized_height; UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR);
char *symbol,hexstr[16384+1]; struct komodo_MoMoMdata mdata; int32_t kmdheight,notarized_height; UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR);
if ( fHelp || params.size() != 3 )
throw runtime_error("MoMoMdata symbol kmdheight notarized_height\n");
LOCK(cs_main);
symbol = (char *)params[0].get_str().c_str();
kmdheight = atoi(params[1].get_str().c_str());
notarized_height = atoi(params[2].get_str().c_str());
if ( (retstr= komodo_MoMoMdata(symbol,kmdheight,notarized_height)) != 0 )
ret.push_back(Pair("coin",symbol));
ret.push_back(Pair("kmdheight",kmdheight));
ret.push_back(Pair("notarized_height",notarized_height));
if ( komodo_MoMoMdata(hexstr,sizeof(hexstr),&mdata,symbol,kmdheight,notarized_height) == 0 )
{
ret.push_back(Pair("coin",symbol));
ret.push_back(Pair("kmdheight",kmdheight));
ret.push_back(Pair("notarized_height",notarized_height));
free(retstr);
}
ret.push_back(Pair("kmdstarti",mdata.kmdstarti));
ret.push_back(Pair("kmdendi",mdata.kmdendi));
ret.push_back(Pair("MoMoM",mdata.MoMoM.ToString()));
ret.push_back(Pair("MoMoMdepth",mdata.MoMoMdepth));
ret.push_back(Pair("numnotarizations",mdata.numpairs));
if ( mdata.pairs != 0 )
{
for (i=0; i<mdata.numpairs; i++)
{
UniValue item(UniValue::VARR);
item.push_back(mdata.pairs[i].notarization_height);
item.push_back(mdata.pairs[i].MoMoMoffset);
a.push_back(item);
}
free(mdata.pairs);
}
ret.push_back(Pair("offsets",a));
ret.push_back(Pair("data",hexstr));
} else ret.push_back(Pair("error","cant calculate MoMoM"));
return(ret);
}
UniValue height_MoM(const UniValue& params, bool fHelp)
{
int32_t height,depth,notarized_height; uint256 MoM,kmdtxid; uint32_t timestamp = 0; UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR);
int32_t height,depth,notarized_height,MoMoMdepth,MoMoMoffset,kmdstarti,kmdendi; uint256 MoM,kmdtxid; uint32_t timestamp = 0; UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR);
if ( fHelp || params.size() != 1 )
throw runtime_error("height_MoM height\n");
LOCK(cs_main);
@@ -626,7 +644,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp)
height = chainActive.Tip()->nHeight;
}
//fprintf(stderr,"height_MoM height.%d\n",height);
depth = komodo_MoM(&notarized_height,&MoM,&kmdtxid,height);
depth = komodo_MoM(&notarized_height,&MoM,&kmdtxid,height,&MoMoM,&MoMoMoffset,&MoMoMdepth,&kmdstarti,&kmdendi);
ret.push_back(Pair("coin",(char *)(ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL)));
ret.push_back(Pair("height",height));
ret.push_back(Pair("timestamp",(uint64_t)timestamp));
@@ -636,6 +654,14 @@ UniValue height_MoM(const UniValue& params, bool fHelp)
ret.push_back(Pair("notarized_height",notarized_height));
ret.push_back(Pair("MoM",MoM.GetHex()));
ret.push_back(Pair("kmdtxid",kmdtxid.GetHex()));
if ( ASSETCHAINS_SYMBOL[0] != 0 )
{
ret.push_back(Pair("MoMoM",MoMoM.GetHex()));
ret.push_back(Pair("MoMoMoffset",MoMoMoffset));
ret.push_back(Pair("MoMoMdepth",MoMoMdepth));
ret.push_back(Pair("kmdstarti",kmdstarti));
ret.push_back(Pair("kmdendi",kmdendi));
}
} else ret.push_back(Pair("error",(char *)"no MoM for height"));
return ret;
@@ -643,11 +669,11 @@ UniValue height_MoM(const UniValue& params, bool fHelp)
UniValue txMoMproof(const UniValue& params, bool fHelp)
{
uint256 hash, notarisationHash, MoM;
uint256 hash, notarisationHash, MoM,MoMoM;
int32_t notarisedHeight, depth;
CBlockIndex* blockIndex;
std::vector<uint256> branch;
int nIndex;
int nIndex,MoMoMdepth,MoMoMoffset,kmdstarti,kmdendi;
// parse params and get notarisation data for tx
{
@@ -663,7 +689,7 @@ UniValue txMoMproof(const UniValue& params, bool fHelp)
blockIndex = mapBlockIndex[blockHash];
depth = komodo_MoM(&notarisedHeight, &MoM, &notarisationHash, blockIndex->nHeight);
depth = komodo_MoM(&notarisedHeight, &MoM, &notarisationHash, blockIndex->nHeight,&MoMoM,&MoMoMoffset,&MoMoMdepth,&kmdstarti,&kmdendi);
if (!depth)
throw runtime_error("notarisation not found");