From e1f53fb668fca90a20e6d22a7314b8f547c90274 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 7 Jul 2019 01:00:38 -1100 Subject: [PATCH] Offset --- src/komodo_nSPV.h | 10 +++++----- src/komodo_nSPV_fullnode.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/komodo_nSPV.h b/src/komodo_nSPV.h index 3b1182440..c339e78df 100644 --- a/src/komodo_nSPV.h +++ b/src/komodo_nSPV.h @@ -410,14 +410,14 @@ int32_t NSPV_txextract(CTransaction &tx,uint8_t *data,int32_t datalen) else return(-1); } -uint256 NSPV_opretextract(int32_t *heightp,uint256 *blockhashp,char *symbol,std::vector opret) +uint256 NSPV_opretextract(int32_t *heightp,uint256 *blockhashp,char *symbol,std::vector opret,int32_t offset) { uint256 desttxid; int32_t i; - iguana_rwnum(0,&opret[32],sizeof(*heightp),heightp); + iguana_rwnum(0,&opret[32+offset],sizeof(*heightp),heightp); for (i=0; i<32; i++) - ((uint8_t *)blockhashp)[i] = opret[4 + i]; + ((uint8_t *)blockhashp)[i] = opret[4 + i + offset]; for (i=0; i<32; i++) - ((uint8_t *)&desttxid)[i] = opret[4 + 32 + i]; + ((uint8_t *)&desttxid)[i] = opret[4 + 32 + i + offset]; return(desttxid); } @@ -437,7 +437,7 @@ int32_t NSPV_notarizationextract(int32_t *heightp,uint256 *blockhashp,uint256 *t numsigs = NSPV_pubkeysextract(sigkeys,tx,elected); GetOpReturnData(tx.vout[1].scriptPubKey,opret); if ( opret.size() >= 32*2+4*2 ) - *desttxidp = NSPV_opretextract(heightp,blockhashp,symbol,&opret[4]); + *desttxidp = NSPV_opretextract(heightp,blockhashp,symbol,opret,4); fprintf(stderr,"ntzht.%d %s txid.%s\n",*heightp,*blockhashp.GetHex().c_str(),*desttxidp.GetHex().c_str()); *txidp = tx.GetHash(); return(0); diff --git a/src/komodo_nSPV_fullnode.h b/src/komodo_nSPV_fullnode.h index d54cec36e..cce334e8d 100644 --- a/src/komodo_nSPV_fullnode.h +++ b/src/komodo_nSPV_fullnode.h @@ -47,7 +47,7 @@ int32_t komodo_notarized_bracket(uint256 txids[2],int32_t txidhts[2],uint256 des return(-1); txids[0] = nota.first; txidhts[0] = txidht; - desttxids[0] = NSPV_opretextract(&ntzheights[0],&bhash,symbol,E_MARSHAL(ss << nota.second)); + desttxids[0] = NSPV_opretextract(&ntzheights[0],&bhash,symbol,E_MARSHAL(ss << nota.second),0); //if ( height != 2668 ) // fprintf(stderr,"scan.%d -> %s txidht.%d ntzht.%d\n",height,desttxids[0].GetHex().c_str(),txidht,ntzheights[0]); if ( ntzheights[0] == height-1 ) // offset the +1 from caller @@ -62,7 +62,7 @@ int32_t komodo_notarized_bracket(uint256 txids[2],int32_t txidhts[2],uint256 des { txids[1] = nota.first; txidhts[1] = txidht; - desttxids[1] = NSPV_opretextract(&ntzheights[1],&bhash,symbol,E_MARSHAL(ss << nota.second)); + desttxids[1] = NSPV_opretextract(&ntzheights[1],&bhash,symbol,E_MARSHAL(ss << nota.second),0); } return(0); }