Browse Source

Truncate MoMdepth

pull/4/head
jl777 6 years ago
parent
commit
1b9f98cd19
  1. 2
      src/komodo_bitcoind.h
  2. 1
      src/komodo_ccdata.h
  3. 4
      src/komodo_notary.h

2
src/komodo_bitcoind.h

@ -932,7 +932,7 @@ int32_t komodo_MoM(int32_t *notarized_heightp,uint256 *MoMp,uint256 *kmdtxidp,in
memset(MoMp,0,sizeof(*MoMp));
memset(kmdtxidp,0,sizeof(*kmdtxidp));
*notarized_heightp = 0;
if ( depth > 0 && notarized_ht > 0 && nHeight > notarized_ht-depth && nHeight <= notarized_ht )
if ( depth != 0 && notarized_ht > 0 && nHeight > notarized_ht-depth && nHeight <= notarized_ht )
{
*MoMp = MoM;
*notarized_heightp = notarized_ht;

1
src/komodo_ccdata.h

@ -45,6 +45,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; int32_t i;
MoMdepth &= 0xffff;
if ( MoMdepth >= height )
return(zero);
tree = (bits256 *)calloc(MoMdepth * 3,sizeof(*tree));

4
src/komodo_notary.h

@ -392,7 +392,7 @@ struct notarized_checkpoint *komodo_npptr(int32_t height)
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 )
if ( np->MoMdepth != 0 && height > np->notarized_height-(np->MoMdepth&0xffff) && height <= np->notarized_height )
return(np);
}
}
@ -447,7 +447,7 @@ int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,in
*MoMoMdepthp = np->MoMoMdepth;
*kmdstartip = np->kmdstarti;
*kmdendip = np->kmdendi;
return(np->MoMdepth);
return(np->MoMdepth & 0xffff);
}
*notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *kmdstartip = *kmdendip = 0;
memset(MoMp,0,sizeof(*MoMp));

Loading…
Cancel
Save