From a043cef2fc6e83281dfb885ced54531aa7790353 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 7 Jul 2019 01:43:03 -1100 Subject: [PATCH] Re-query ntz tx --- src/komodo_nSPV_fullnode.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/komodo_nSPV_fullnode.h b/src/komodo_nSPV_fullnode.h index 579d02fa4..2608ad3f5 100644 --- a/src/komodo_nSPV_fullnode.h +++ b/src/komodo_nSPV_fullnode.h @@ -37,7 +37,7 @@ uint256 NSPV_getnotarization_txid(int32_t *ntzheightp,int32_t height) int32_t komodo_notarized_bracket(uint256 txids[2],int32_t txidhts[2],uint256 desttxids[2],int32_t ntzheights[2],int32_t height) { - int32_t txidht; Notarisation nota; char *symbol; uint256 bhash0,bhash1; + int32_t txidht; CTransaction tx; Notarisation nota; char *symbol; std::vector opret; uint256 bhash0,bhash1,hashBlock; symbol = (ASSETCHAINS_SYMBOL[0] == 0) ? (char *)"KMD" : ASSETCHAINS_SYMBOL; memset(txids,0,sizeof(*txids)*2); memset(desttxids,0,sizeof(*desttxids)*2); @@ -47,8 +47,14 @@ 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],&bhash0,symbol,E_MARSHAL(ss << nota.second)); - /*//if ( height != 2668 ) + if ( !GetTransaction(txids[0],tx,hashBlock,false) || tx.vout.size() < 2 ) + return(-2); + GetOpReturnData(tx.vout[1].scriptPubKey,opret); + if ( opret.size() >= 32*2+4*2 ) + desttxids[0] = NSPV_opretextract(&ntzheights[0],&bhash0,symbol,opret); + + /*desttxids[0] = NSPV_opretextract(&ntzheights[0],&bhash0,symbol,E_MARSHAL(ss << nota.second)); + //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 +68,12 @@ 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],&bhash1,symbol,E_MARSHAL(ss << nota.second)); + if ( !GetTransaction(txids[1],tx,hashBlock,false) || tx.vout.size() < 2 ) + return(-2); + GetOpReturnData(tx.vout[1].scriptPubKey,opret); + if ( opret.size() >= 32*2+4*2 ) + desttxids[1] = NSPV_opretextract(&ntzheights[1],&bhash1,symbol,opret); + //desttxids[1] = NSPV_opretextract(&ntzheights[1],&bhash1,symbol,E_MARSHAL(ss << nota.second)); } fprintf(stderr,"prev.(%s -> ht.%d %s) next.(%s -> ht.%d %s)\n",txids[0].GetHex().c_str(),ntzheights[0],bhash0.GetHex().c_str(),txids[1].GetHex().c_str(),ntzheights[1],bhash1.GetHex().c_str()); return(0);