From fb9320dfbb7da5429ba82ac3b8f82b4940b6f4eb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 13 May 2019 15:54:15 +0800 Subject: [PATCH] fix payments allocation for alright --- src/cc/payments.cpp | 3 ++- src/rpc/misc.cpp | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/cc/payments.cpp b/src/cc/payments.cpp index a8630f25c..63e9f4681 100644 --- a/src/cc/payments.cpp +++ b/src/cc/payments.cpp @@ -426,8 +426,9 @@ bool PaymentsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & test = mpz_get_si(mpzAllocation); mpz_clear(mpzAllocation); } + //fprintf(stderr, "vout %i test.%li nValue.%li\n", i, test, tx.vout[i].nValue); // Vairance of 1 sat is allowed, for rounding errors. - if ( test >= tx.vout[i].nValue+1 && test <= tx.vout[i].nValue-1 ) + if ( test > tx.vout[i].nValue+1 || test < tx.vout[i].nValue-1 ) { fprintf(stderr, "vout.%i test.%li vs nVlaue.%li\n",i, test, tx.vout[i].nValue); return(eval->Invalid("amounts do not match")); diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 4ea6e94e3..058cd0241 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -1383,9 +1383,13 @@ UniValue getsnapshot(const UniValue& params, bool fHelp) if (params.size() > 0 && !params[0].isNull()) { top = atoi(params[0].get_str().c_str()); - if (top < 0) - //throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, top must be a positive integer"); - top = -1; + if ( top < 0 ) + { + if ( KOMODO_SNAPSHOT_INTERVAL == 0 ) + throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, top must be a positive integer"); + else + top = -1; + } } if ( fHelp || params.size() > 1)