Test
This commit is contained in:
@@ -99,15 +99,18 @@ bool FaucetValidate(Eval* eval,const CTransaction &tx)
|
|||||||
return eval->Invalid("no vouts");
|
return eval->Invalid("no vouts");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
fprintf(stderr,"check vins\n");
|
||||||
for (i=0; i<numvins; i++)
|
for (i=0; i<numvins; i++)
|
||||||
{
|
{
|
||||||
if ( IsCCInput(tx.vin[0].scriptSig) == 0 )
|
if ( IsCCInput(tx.vin[0].scriptSig) == 0 )
|
||||||
return eval->Invalid("illegal normal vini");
|
return eval->Invalid("illegal normal vini");
|
||||||
}
|
}
|
||||||
|
fprintf(stderr,"check amounts\n");
|
||||||
if ( FaucetExactAmounts(eval,tx,1,10000) == false )
|
if ( FaucetExactAmounts(eval,tx,1,10000) == false )
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
fprintf(stderr,"check rest\n");
|
||||||
preventCCvouts = 1;
|
preventCCvouts = 1;
|
||||||
if ( IsFaucetvout(tx,0) != 0 )
|
if ( IsFaucetvout(tx,0) != 0 )
|
||||||
{
|
{
|
||||||
@@ -116,6 +119,7 @@ bool FaucetValidate(Eval* eval,const CTransaction &tx)
|
|||||||
} else i = 0;
|
} else i = 0;
|
||||||
if ( tx.vout[i].nValue != COIN )
|
if ( tx.vout[i].nValue != COIN )
|
||||||
return eval->Invalid("invalid faucet output");
|
return eval->Invalid("invalid faucet output");
|
||||||
|
fprintf(stderr,"check CC\n");
|
||||||
return(PreventCC(eval,tx,preventCCvins,numvins,preventCCvouts,numvouts));
|
return(PreventCC(eval,tx,preventCCvins,numvins,preventCCvouts,numvouts));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,6 +127,10 @@ bool FaucetValidate(Eval* eval,const CTransaction &tx)
|
|||||||
|
|
||||||
bool ProcessFaucet(Eval* eval, std::vector<uint8_t> paramsNull,const CTransaction &ctx, unsigned int nIn)
|
bool ProcessFaucet(Eval* eval, std::vector<uint8_t> paramsNull,const CTransaction &ctx, unsigned int nIn)
|
||||||
{
|
{
|
||||||
|
static uint256 prevtxid; uint256 txid;
|
||||||
|
txid = ctx.GetHash();
|
||||||
|
if ( txid == prevtxid )
|
||||||
|
return(true);
|
||||||
fprintf(stderr,"start faucet validate\n");
|
fprintf(stderr,"start faucet validate\n");
|
||||||
if ( paramsNull.size() != 0 ) // Don't expect params
|
if ( paramsNull.size() != 0 ) // Don't expect params
|
||||||
return eval->Invalid("Cannot have params");
|
return eval->Invalid("Cannot have params");
|
||||||
@@ -130,6 +138,7 @@ bool ProcessFaucet(Eval* eval, std::vector<uint8_t> paramsNull,const CTransactio
|
|||||||
return eval->Invalid("no-vouts");
|
return eval->Invalid("no-vouts");
|
||||||
if ( FaucetValidate(eval,ctx) != 0 )
|
if ( FaucetValidate(eval,ctx) != 0 )
|
||||||
{
|
{
|
||||||
|
prevtxid = txid;
|
||||||
fprintf(stderr,"faucet validated\n");
|
fprintf(stderr,"faucet validated\n");
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,12 +127,19 @@ bool RewardsValidate(Eval* eval,const CTransaction &tx)
|
|||||||
|
|
||||||
bool ProcessRewards(Eval* eval, std::vector<uint8_t> paramsNull,const CTransaction &ctx, unsigned int nIn)
|
bool ProcessRewards(Eval* eval, std::vector<uint8_t> paramsNull,const CTransaction &ctx, unsigned int nIn)
|
||||||
{
|
{
|
||||||
|
static uint256 prevtxid; uint256 txid;
|
||||||
|
txid = ctx.GetHash();
|
||||||
|
if ( txid == prevtxid )
|
||||||
|
return(true);
|
||||||
if ( paramsNull.size() != 0 ) // Don't expect params
|
if ( paramsNull.size() != 0 ) // Don't expect params
|
||||||
return eval->Invalid("Cannot have params");
|
return eval->Invalid("Cannot have params");
|
||||||
else if ( ctx.vout.size() == 0 )
|
else if ( ctx.vout.size() == 0 )
|
||||||
return eval->Invalid("no-vouts");
|
return eval->Invalid("no-vouts");
|
||||||
if ( RewardsValidate(eval,ctx) != 0 )
|
if ( RewardsValidate(eval,ctx) != 0 )
|
||||||
|
{
|
||||||
|
prevtxid = txid;
|
||||||
return(true);
|
return(true);
|
||||||
|
}
|
||||||
else return(false);
|
else return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user