Consensus stable faucet get constraint

This commit is contained in:
jl777
2018-08-15 07:41:28 -11:00
parent f344c69338
commit 8d13c0ef19

View File

@@ -79,7 +79,7 @@ bool FaucetExactAmounts(struct CCcontract_info *cp,Eval* eval,const CTransaction
bool FaucetValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx)
{
int32_t numvins,numvouts,preventCCvins,preventCCvouts,i,j=0; bool retval; uint256 txid; uint8_t hash[32]; char str[65],destaddr[64];
int32_t numvins,numvouts,preventCCvins,preventCCvouts,i,numblocks; bool retval; uint256 txid; uint8_t hash[32]; char str[65],destaddr[64];
std::vector<std::pair<CAddressIndexKey, CAmount> > txids;
numvins = tx.vin.size();
numvouts = tx.vout.size();
@@ -121,8 +121,8 @@ bool FaucetValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx
SetCCtxids(txids,destaddr);
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
{
if ( ++j > 1 )
return eval->Invalid("faucet is only for unused addresses");
if ( CCduration(numblocks,it->first.txhash) > 0 && numblocks > 3 )
return eval->Invalid("faucet is only for brand new addresses");
}
retval = PreventCC(eval,tx,preventCCvins,numvins,preventCCvouts,numvouts);
if ( retval != 0 )