From 723ae0eab9634c31549f2c541f2083767815b7e1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 23 Jul 2018 19:47:53 -1100 Subject: [PATCH] Test --- src/cc/faucet.cpp | 9 +++++++++ src/cc/rewards.cpp | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/src/cc/faucet.cpp b/src/cc/faucet.cpp index 1a04dfed9..8dc70dab5 100644 --- a/src/cc/faucet.cpp +++ b/src/cc/faucet.cpp @@ -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; iInvalid("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 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 paramsNull,const CTransactio return eval->Invalid("no-vouts"); if ( FaucetValidate(eval,ctx) != 0 ) { + prevtxid = txid; fprintf(stderr,"faucet validated\n"); return(true); } diff --git a/src/cc/rewards.cpp b/src/cc/rewards.cpp index a6855cc8f..0af15f2ce 100644 --- a/src/cc/rewards.cpp +++ b/src/cc/rewards.cpp @@ -127,12 +127,19 @@ bool RewardsValidate(Eval* eval,const CTransaction &tx) bool ProcessRewards(Eval* eval, std::vector 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 return eval->Invalid("Cannot have params"); else if ( ctx.vout.size() == 0 ) return eval->Invalid("no-vouts"); if ( RewardsValidate(eval,ctx) != 0 ) + { + prevtxid = txid; return(true); + } else return(false); }