Browse Source

Fix off by ones

pull/4/head
jl777 6 years ago
parent
commit
16ed777a8c
  1. 2
      src/komodo_bitcoind.h
  2. 4
      src/komodo_notary.h
  3. 2
      src/rpcblockchain.cpp

2
src/komodo_bitcoind.h

@ -818,7 +818,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;

4
src/komodo_notary.h

@ -409,8 +409,8 @@ int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,in
np = &sp->NPOINTS[i];
if ( np->MoMdepth > 0 && nHeight > np->nHeight-np->MoMdepth && nHeight <= np->nHeight )
{
printf("komodo_MoMdata.(%s -> %s) %d i.%d np->ht %d MoMdepth.%d\n",symbol,dest,nHeight,i,np->nHeight,np->MoMdepth);
*notarized_htp = np->nHeight;
//printf("komodo_MoMdata.(%s -> %s) %d i.%d np->ht %d MoMdepth.%d\n",symbol,dest,nHeight,i,np->nHeight,np->MoMdepth);
*notarized_htp = np->notarized_height;
*MoMp = np->MoM;
*kmdtxidp = np->notarized_desttxid;
return(np->MoMdepth);

2
src/rpcblockchain.cpp

@ -580,7 +580,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp)
}
height = chainActive.Tip()->nHeight;
}
fprintf(stderr,"height_MoM height.%d\n",height);
//fprintf(stderr,"height_MoM height.%d\n",height);
depth = komodo_MoM(&notarized_height,&MoM,&kmdtxid,height);
ret.push_back(Pair("coin",(char *)(ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL)));
ret.push_back(Pair("height",height));

Loading…
Cancel
Save