This commit is contained in:
jl777
2018-07-23 19:47:53 -11:00
parent 0548be2094
commit 723ae0eab9
2 changed files with 16 additions and 0 deletions

View File

@@ -99,15 +99,18 @@ bool FaucetValidate(Eval* eval,const CTransaction &tx)
return eval->Invalid("no vouts");
else
{
fprintf(stderr,"check vins\n");
for (i=0; i<numvins; i++)
{
if ( IsCCInput(tx.vin[0].scriptSig) == 0 )
return eval->Invalid("illegal normal vini");
}
fprintf(stderr,"check amounts\n");
if ( FaucetExactAmounts(eval,tx,1,10000) == false )
return false;
else
{
fprintf(stderr,"check rest\n");
preventCCvouts = 1;
if ( IsFaucetvout(tx,0) != 0 )
{
@@ -116,6 +119,7 @@ bool FaucetValidate(Eval* eval,const CTransaction &tx)
} else i = 0;
if ( tx.vout[i].nValue != COIN )
return eval->Invalid("invalid faucet output");
fprintf(stderr,"check CC\n");
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)
{
static uint256 prevtxid; uint256 txid;
txid = ctx.GetHash();
if ( txid == prevtxid )
return(true);
fprintf(stderr,"start faucet validate\n");
if ( paramsNull.size() != 0 ) // Don't expect 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");
if ( FaucetValidate(eval,ctx) != 0 )
{
prevtxid = txid;
fprintf(stderr,"faucet validated\n");
return(true);
}