From 16ed777a8c7ae8e3d7605aa555a7781ee7795fd4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 24 Mar 2018 14:28:18 +0200 Subject: [PATCH] Fix off by ones --- src/komodo_bitcoind.h | 2 +- src/komodo_notary.h | 4 ++-- src/rpcblockchain.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index d6e36cfde..3603b4135 100644 --- a/src/komodo_bitcoind.h +++ b/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; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 1c5e9c9e2..32a9673f8 100644 --- a/src/komodo_notary.h +++ b/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); diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 5075fb200..7c167afc4 100644 --- a/src/rpcblockchain.cpp +++ b/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(¬arized_height,&MoM,&kmdtxid,height); ret.push_back(Pair("coin",(char *)(ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL))); ret.push_back(Pair("height",height));