Test
This commit is contained in:
@@ -78,7 +78,7 @@ bool FaucetExactAmounts(Eval* eval,const CTransaction &tx,int32_t minage)
|
|||||||
if ( (assetoshis= IsFaucetvout(tx,i)) != 0 )
|
if ( (assetoshis= IsFaucetvout(tx,i)) != 0 )
|
||||||
outputs += assetoshis;
|
outputs += assetoshis;
|
||||||
}
|
}
|
||||||
if ( inputs != outputs )
|
if ( inputs != outputs+COIN )
|
||||||
return(false);
|
return(false);
|
||||||
else return(true);
|
else return(true);
|
||||||
}
|
}
|
||||||
@@ -89,23 +89,29 @@ bool FaucetValidate(Eval* eval,const CTransaction &tx)
|
|||||||
numvins = tx.vin.size();
|
numvins = tx.vin.size();
|
||||||
numvouts = tx.vout.size();
|
numvouts = tx.vout.size();
|
||||||
preventCCvins = preventCCvouts = -1;
|
preventCCvins = preventCCvouts = -1;
|
||||||
if ( IsCCInput(tx.vin[0].scriptSig) != 0 )
|
if ( numvouts < 1 )
|
||||||
return eval->Invalid("illegal asset vin0");
|
|
||||||
else if ( numvouts < 1 )
|
|
||||||
return eval->Invalid("no vouts");
|
return eval->Invalid("no vouts");
|
||||||
else if ( FaucetExactAmounts(eval,tx,1) == false )
|
|
||||||
eval->Invalid("asset inputs != outputs");
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
preventCCvouts = 1;
|
for (i=0; i<numvins; i++)
|
||||||
if ( IsFaucetvout(tx,0) != 0 )
|
|
||||||
{
|
{
|
||||||
preventCCvouts++;
|
if ( IsCCInput(tx.vin[0].scriptSig) == 0 )
|
||||||
i = 1;
|
return eval->Invalid("illegal normal vini");
|
||||||
} else i = 0;
|
}
|
||||||
if ( tx.vout[i].nValue != COIN )
|
if ( FaucetExactAmounts(eval,tx,1) == false )
|
||||||
return(false);
|
eval->Invalid("asset inputs != outputs");
|
||||||
return(PreventCC(eval,tx,preventCCvins,numvins,preventCCvouts,numvouts));
|
else
|
||||||
|
{
|
||||||
|
preventCCvouts = 1;
|
||||||
|
if ( IsFaucetvout(tx,0) != 0 )
|
||||||
|
{
|
||||||
|
preventCCvouts++;
|
||||||
|
i = 1;
|
||||||
|
} else i = 0;
|
||||||
|
if ( tx.vout[i].nValue != COIN )
|
||||||
|
return(false);
|
||||||
|
return(PreventCC(eval,tx,preventCCvins,numvins,preventCCvouts,numvouts));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user