From 8d13c0ef190900c64c55bd1eaedfff478d4df8d8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 15 Aug 2018 07:41:28 -1100 Subject: [PATCH] Consensus stable faucet get constraint --- src/cc/faucet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cc/faucet.cpp b/src/cc/faucet.cpp index 827dc2716..142100c70 100644 --- a/src/cc/faucet.cpp +++ b/src/cc/faucet.cpp @@ -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 > 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 >::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 )