diff --git a/src/komodo_nSPV.h b/src/komodo_nSPV.h index f717798a4..d70c1da33 100644 --- a/src/komodo_nSPV.h +++ b/src/komodo_nSPV.h @@ -376,12 +376,12 @@ uint256 NSPV_extract_desttxid(int32_t *heightp,char *symbol,std::vector for (i=0; i<4; i++) fprintf(stderr,"%02x",opret[32+i]); fprintf(stderr," height, "); - iguana_rwnum(1,&opret[32],sizeof(*heightp),heightp); + iguana_rwnum(0,&opret[32],sizeof(*heightp),heightp); for (i=0; i<32; i++) fprintf(stderr,"%02x",opret[36+i]); fprintf(stderr," desttxid\n"); for (i=0; i<32; i++) - ((uint8_t *)&desttxid)[i] = opret[4 + 32 + 31 - i]; + ((uint8_t *)&desttxid)[i] = opret[4 + 32 + i]; return(desttxid); } @@ -398,6 +398,7 @@ int32_t komodo_notarized_bracket(uint256 txids[2],int32_t txidhts[2],uint256 des txids[0] = nota.first; txidhts[0] = txidht; desttxids[0] = NSPV_extract_desttxid(&ntzheights[0],symbol,E_MARSHAL(ss << nota.second)); + fprintf(stderr,"scan.%d -> %s txidht.%d ntzht.%d\n",height,desttxids[0].GetHex().c_str(),txidht,ntzheights[0]); if ( ntzheights[0] == height ) { txids[1] = txids[0]; @@ -406,7 +407,7 @@ int32_t komodo_notarized_bracket(uint256 txids[2],int32_t txidhts[2],uint256 des desttxids[1] = desttxids[0]; return(0); } - if ( (txidht= ScanNotarisationsDB2(height+1,symbol,1440,nota)) != 0 ) + if ( (txidht= ScanNotarisationsDB2(height,symbol,1440,nota)) != 0 ) { txids[1] = nota.first; txidhts[1] = txidht; @@ -428,6 +429,8 @@ int32_t NSPV_ntzextract(struct NSPV_ntz *ptr,uint256 ntztxid,int32_t txidht,uint int32_t NSPV_getntzsresp(struct NSPV_ntzsresp *ptr,int32_t height) { uint256 txids[2],desttxids[2]; int32_t ntzheights[2],txidhts[2]; + if ( height < chainActive.LastTip()->GetHeight() ) + height++; if ( komodo_notarized_bracket(txids,txidhts,desttxids,ntzheights,height) == 0 ) { if ( ntzheights[0] != 0 )