From da8b0b333653ce2539fd61c3d1fc6f27a9944fe2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 24 Jul 2018 00:56:29 -1100 Subject: [PATCH] Test --- src/cc/CCcustom.cpp | 2 ++ src/cc/faucet.cpp | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/cc/CCcustom.cpp b/src/cc/CCcustom.cpp index 8ebbe821d..d15e43a02 100644 --- a/src/cc/CCcustom.cpp +++ b/src/cc/CCcustom.cpp @@ -30,6 +30,8 @@ 2. initialize the variables in the CCinit function below 3. write a Validate function to reject any unsanctioned usage of vin/vout 4. make helper functions to create rawtx for RPC functions + 5. add rpc calls to rpcserver.cpp and rpcserver.h and in one of the rpc.cpp files + 6. add the new .cpp files to src/Makefile.am */ //BTCD Address: RAssetsAtGnvwgK9gVHBbAU4sVTah1hAm5 diff --git a/src/cc/faucet.cpp b/src/cc/faucet.cpp index 0882e0a6b..00b01d76f 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; + int32_t numvins,numvouts,preventCCvins,preventCCvouts,i; bool retval; numvins = tx.vin.size(); numvouts = tx.vout.size(); preventCCvins = preventCCvouts = -1; @@ -87,18 +87,23 @@ bool FaucetValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx return eval->Invalid("no vouts"); else { - fprintf(stderr,"check vins\n"); + //fprintf(stderr,"check vins\n"); for (i=0; iInvalid("illegal normal vini"); + } } - fprintf(stderr,"check amounts\n"); + //fprintf(stderr,"check amounts\n"); if ( FaucetExactAmounts(cp,eval,tx,1,10000) == false ) + { + fprintf(stderr,"faucetget invalid amount\n"); return false; + } else { - fprintf(stderr,"check rest\n"); preventCCvouts = 1; if ( IsFaucetvout(cp,tx,0) != 0 ) { @@ -107,8 +112,11 @@ bool FaucetValidate(struct CCcontract_info *cp,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)); + retval = PreventCC(eval,tx,preventCCvins,numvins,preventCCvouts,numvouts); + if ( retval != 0 ) + fprintf(stderr,"faucetget validated\n"); + else fprintf(stderr,"faucetget invalid\n"); + return(retval); } } }