This commit is contained in:
jl777
2019-07-08 05:25:52 -11:00
parent 28d438336e
commit 0219ccbe6f
3 changed files with 10 additions and 7 deletions

View File

@@ -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<uint8_t> 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);

View File

@@ -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);

View File

@@ -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);