+prints
This commit is contained in:
@@ -426,7 +426,10 @@ int32_t NSPV_notariescount(CTransaction tx,uint8_t elected[64][33])
|
|||||||
{
|
{
|
||||||
utxovout = tx.vin[i].prevout.n;
|
utxovout = tx.vin[i].prevout.n;
|
||||||
if ( NSPV_gettransaction(1,utxovout,tx.vin[i].prevout.hash,0,tx) != 0 )
|
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);
|
return(numsigs);
|
||||||
|
}
|
||||||
if ( utxovout < vintx.vout.size() )
|
if ( utxovout < vintx.vout.size() )
|
||||||
{
|
{
|
||||||
script = (uint8_t *)&vintx.vout[utxovout].scriptPubKey[0];
|
script = (uint8_t *)&vintx.vout[utxovout].scriptPubKey[0];
|
||||||
@@ -439,7 +442,7 @@ int32_t NSPV_notariescount(CTransaction tx,uint8_t elected[64][33])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else fprintf(stderr,"invalid scriptlen.%d\n",scriptlen);
|
} 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);
|
fprintf(stderr,"numvins.%d numsigs.%d\n",(int32_t)tx.vin.size(),numsigs);
|
||||||
return(numsigs);
|
return(numsigs);
|
||||||
@@ -458,7 +461,7 @@ uint256 NSPV_opretextract(int32_t *heightp,uint256 *blockhashp,char *symbol,std:
|
|||||||
return(desttxid);
|
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;
|
int32_t numsigs; uint8_t elected[64][33]; char *symbol; std::vector<uint8_t> opret;
|
||||||
if ( tx.vout.size() >= 2 )
|
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());
|
*desttxidp = NSPV_opretextract(ntzheightp,blockhashp,symbol,opret,tx.GetHash());
|
||||||
komodo_notaries(elected,*ntzheightp,0);
|
komodo_notaries(elected,*ntzheightp,0);
|
||||||
if ( (numsigs= NSPV_notariescount(tx,elected)) < 12 )
|
if ( verifyntz != 0 && (numsigs= NSPV_notariescount(tx,elected)) < 12 )
|
||||||
return(-3);
|
return(-3);
|
||||||
return(0);
|
return(0);
|
||||||
} else return(-2);
|
} else return(-2);
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ int32_t NSPV_getntzsproofresp(struct NSPV_ntzsproofresp *ptr,uint256 prevntztxid
|
|||||||
ptr->prevtxid = prevntztxid;
|
ptr->prevtxid = prevntztxid;
|
||||||
ptr->prevntz = NSPV_getrawtx(tx,hashBlock,&ptr->prevtxlen,ptr->prevtxid);
|
ptr->prevntz = NSPV_getrawtx(tx,hashBlock,&ptr->prevtxlen,ptr->prevtxid);
|
||||||
ptr->prevtxidht = komodo_blockheight(hashBlock);
|
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);
|
return(-2);
|
||||||
else if ( komodo_blockheight(bhash0) != ptr->common.prevht )
|
else if ( komodo_blockheight(bhash0) != ptr->common.prevht )
|
||||||
return(-3);
|
return(-3);
|
||||||
@@ -273,7 +273,7 @@ int32_t NSPV_getntzsproofresp(struct NSPV_ntzsproofresp *ptr,uint256 prevntztxid
|
|||||||
ptr->nexttxid = nextntztxid;
|
ptr->nexttxid = nextntztxid;
|
||||||
ptr->nextntz = NSPV_getrawtx(tx,hashBlock,&ptr->nexttxlen,ptr->nexttxid);
|
ptr->nextntz = NSPV_getrawtx(tx,hashBlock,&ptr->nexttxlen,ptr->nexttxid);
|
||||||
ptr->nexttxidht = komodo_blockheight(hashBlock);
|
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);
|
return(-5);
|
||||||
else if ( komodo_blockheight(bhash1) != ptr->common.nextht )
|
else if ( komodo_blockheight(bhash1) != ptr->common.nextht )
|
||||||
return(-6);
|
return(-6);
|
||||||
|
|||||||
@@ -553,7 +553,7 @@ int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr)
|
|||||||
return(-2);
|
return(-2);
|
||||||
else if ( tx.GetHash() != ptr->nexttxid )
|
else if ( tx.GetHash() != ptr->nexttxid )
|
||||||
return(-3);
|
return(-3);
|
||||||
else if ( NSPV_notarizationextract(&height,&blockhash,&desttxid,tx) < 0 )
|
else if ( NSPV_notarizationextract(1,&height,&blockhash,&desttxid,tx) < 0 )
|
||||||
return(-4);
|
return(-4);
|
||||||
else if ( height != ptr->common.nextht )
|
else if ( height != ptr->common.nextht )
|
||||||
return(-5);
|
return(-5);
|
||||||
@@ -569,7 +569,7 @@ int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr)
|
|||||||
return(-7);
|
return(-7);
|
||||||
else if ( tx.GetHash() != ptr->prevtxid )
|
else if ( tx.GetHash() != ptr->prevtxid )
|
||||||
return(-8);
|
return(-8);
|
||||||
else if ( NSPV_notarizationextract(&height,&blockhash,&desttxid,tx) < 0 )
|
else if ( NSPV_notarizationextract(1,&height,&blockhash,&desttxid,tx) < 0 )
|
||||||
return(-9);
|
return(-9);
|
||||||
else if ( height != ptr->common.prevht )
|
else if ( height != ptr->common.prevht )
|
||||||
return(-10);
|
return(-10);
|
||||||
|
|||||||
Reference in New Issue
Block a user