From 0219ccbe6f04844b3fcbdde5eadb1b8e59f0f0ab Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 8 Jul 2019 05:25:52 -1100 Subject: [PATCH] +prints --- src/komodo_nSPV.h | 9 ++++++--- src/komodo_nSPV_fullnode.h | 4 ++-- src/komodo_nSPV_superlite.h | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/komodo_nSPV.h b/src/komodo_nSPV.h index 10a2abecf..fabfef560 100644 --- a/src/komodo_nSPV.h +++ b/src/komodo_nSPV.h @@ -426,7 +426,10 @@ int32_t NSPV_notariescount(CTransaction tx,uint8_t elected[64][33]) { utxovout = tx.vin[i].prevout.n; if ( NSPV_gettransaction(1,utxovout,tx.vin[i].prevout.hash,0,tx) != 0 ) + { + fprintf(stderr,"error getting %s/v%d\n",tx.vin[i].prevout.hash.GetHex().c_str(),utxovout); return(numsigs); + } if ( utxovout < vintx.vout.size() ) { script = (uint8_t *)&vintx.vout[utxovout].scriptPubKey[0]; @@ -439,7 +442,7 @@ int32_t NSPV_notariescount(CTransaction tx,uint8_t elected[64][33]) break; } } else fprintf(stderr,"invalid scriptlen.%d\n",scriptlen); - } + } else fprintf(stderr,"invalid utxovout.%d vs %d\n",utxovout,(int32_t)vintx.vout.size()); } fprintf(stderr,"numvins.%d numsigs.%d\n",(int32_t)tx.vin.size(),numsigs); return(numsigs); @@ -458,7 +461,7 @@ uint256 NSPV_opretextract(int32_t *heightp,uint256 *blockhashp,char *symbol,std: return(desttxid); } -int32_t NSPV_notarizationextract(int32_t *ntzheightp,uint256 *blockhashp,uint256 *desttxidp,CTransaction tx) +int32_t NSPV_notarizationextract(int32_t verifyntz,int32_t *ntzheightp,uint256 *blockhashp,uint256 *desttxidp,CTransaction tx) { int32_t numsigs; uint8_t elected[64][33]; char *symbol; std::vector opret; if ( tx.vout.size() >= 2 ) @@ -469,7 +472,7 @@ int32_t NSPV_notarizationextract(int32_t *ntzheightp,uint256 *blockhashp,uint256 { *desttxidp = NSPV_opretextract(ntzheightp,blockhashp,symbol,opret,tx.GetHash()); komodo_notaries(elected,*ntzheightp,0); - if ( (numsigs= NSPV_notariescount(tx,elected)) < 12 ) + if ( verifyntz != 0 && (numsigs= NSPV_notariescount(tx,elected)) < 12 ) return(-3); return(0); } else return(-2); diff --git a/src/komodo_nSPV_fullnode.h b/src/komodo_nSPV_fullnode.h index 396fa1105..ff78948f6 100644 --- a/src/komodo_nSPV_fullnode.h +++ b/src/komodo_nSPV_fullnode.h @@ -265,7 +265,7 @@ int32_t NSPV_getntzsproofresp(struct NSPV_ntzsproofresp *ptr,uint256 prevntztxid ptr->prevtxid = prevntztxid; ptr->prevntz = NSPV_getrawtx(tx,hashBlock,&ptr->prevtxlen,ptr->prevtxid); ptr->prevtxidht = komodo_blockheight(hashBlock); - if ( NSPV_notarizationextract(&ptr->common.prevht,&bhash0,&desttxid0,tx) < 0 ) + if ( NSPV_notarizationextract(0,&ptr->common.prevht,&bhash0,&desttxid0,tx) < 0 ) return(-2); else if ( komodo_blockheight(bhash0) != ptr->common.prevht ) return(-3); @@ -273,7 +273,7 @@ int32_t NSPV_getntzsproofresp(struct NSPV_ntzsproofresp *ptr,uint256 prevntztxid ptr->nexttxid = nextntztxid; ptr->nextntz = NSPV_getrawtx(tx,hashBlock,&ptr->nexttxlen,ptr->nexttxid); ptr->nexttxidht = komodo_blockheight(hashBlock); - if ( NSPV_notarizationextract(&ptr->common.nextht,&bhash1,&desttxid1,tx) < 0 ) + if ( NSPV_notarizationextract(0,&ptr->common.nextht,&bhash1,&desttxid1,tx) < 0 ) return(-5); else if ( komodo_blockheight(bhash1) != ptr->common.nextht ) return(-6); diff --git a/src/komodo_nSPV_superlite.h b/src/komodo_nSPV_superlite.h index 5a0e152fd..eb42bedd8 100644 --- a/src/komodo_nSPV_superlite.h +++ b/src/komodo_nSPV_superlite.h @@ -553,7 +553,7 @@ int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr) return(-2); else if ( tx.GetHash() != ptr->nexttxid ) return(-3); - else if ( NSPV_notarizationextract(&height,&blockhash,&desttxid,tx) < 0 ) + else if ( NSPV_notarizationextract(1,&height,&blockhash,&desttxid,tx) < 0 ) return(-4); else if ( height != ptr->common.nextht ) return(-5); @@ -569,7 +569,7 @@ int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr) return(-7); else if ( tx.GetHash() != ptr->prevtxid ) return(-8); - else if ( NSPV_notarizationextract(&height,&blockhash,&desttxid,tx) < 0 ) + else if ( NSPV_notarizationextract(1,&height,&blockhash,&desttxid,tx) < 0 ) return(-9); else if ( height != ptr->common.prevht ) return(-10);