From 4148e39f731e500e0dd4d5a182fab5139b64e76d Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 7 Nov 2018 00:29:34 -1100 Subject: [PATCH] Return eval->error --- src/cc/assets.cpp | 4 ++-- src/cc/channels.cpp | 2 +- src/cc/dice.cpp | 8 ++++---- src/cc/oracles.cpp | 2 +- src/cc/rewards.cpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/cc/assets.cpp b/src/cc/assets.cpp index b1896ad9c..a421f9e44 100644 --- a/src/cc/assets.cpp +++ b/src/cc/assets.cpp @@ -322,7 +322,7 @@ bool AssetsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx fprintf(stderr,"fill validated\n"); break; case 'E': // fillexchange - return(false); + return eval->Invalid("unexpected assets fillexchange funcid"); break; // disable asset swaps //vin.0: normal input //vin.1: unspendable.(vout.0 assetoshis from selloffer) sellTx.vout[0] @@ -374,7 +374,7 @@ bool AssetsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx break; default: fprintf(stderr,"illegal assets funcid.(%c)\n",funcid); - return(false); + return eval->Invalid("unexpected assets funcid"); break; } return(PreventCC(eval,tx,preventCCvins,numvins,preventCCvouts,numvouts)); diff --git a/src/cc/channels.cpp b/src/cc/channels.cpp index 7218177d7..4a209fb36 100644 --- a/src/cc/channels.cpp +++ b/src/cc/channels.cpp @@ -350,7 +350,7 @@ bool ChannelsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & break; default: fprintf(stderr,"illegal channels funcid.(%c)\n",funcid); - return(false); + return eval->Invalid("unexpected channels funcid"); break; } } diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index c96545e7d..70f686725 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -597,11 +597,11 @@ bool DiceValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &tx) return eval->Invalid("always should find vinofvin.0, but didnt for bet"); else if ( vinTx.vin[0].prevout.hash != fundingtxid ) { - if ( vinofvinTx.vout[1].scriptPubKey != fundingPubKey ) - //if ( vinofvinTx.vout[vinTx.vin[0].prevout.n].scriptPubKey != fundingPubKey ) + //if ( vinofvinTx.vout[1].scriptPubKey != fundingPubKey ) + if ( vinofvinTx.vout[vinTx.vin[0].prevout.n].scriptPubKey != fundingPubKey ) { uint8_t *ptr0,*ptr1; int32_t i; char str[65]; - fprintf(stderr,"bidTx.%s\n",uint256_str(str,txid)); + fprintf(stderr,"betTx.%s\n",uint256_str(str,txid)); fprintf(stderr,"entropyTx.%s v%d\n",uint256_str(str,tx.vin[0].prevout.hash),(int32_t)tx.vin[0].prevout.n); fprintf(stderr,"entropyTx vin0 %s v%d\n",uint256_str(str,vinTx.vin[0].prevout.hash),(int32_t)vinTx.vin[0].prevout.n); ptr0 = (uint8_t *)vinofvinTx.vout[vinTx.vin[0].prevout.n].scriptPubKey.data(); @@ -701,7 +701,7 @@ bool DiceValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &tx) break; default: fprintf(stderr,"illegal dice funcid.(%c)\n",funcid); - return(false); + return eval->Invalid("unexpected dice funcid"); break; } } diff --git a/src/cc/oracles.cpp b/src/cc/oracles.cpp index 0f636551c..2955ad6a2 100644 --- a/src/cc/oracles.cpp +++ b/src/cc/oracles.cpp @@ -653,7 +653,7 @@ bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &t break; default: fprintf(stderr,"illegal oracles funcid.(%c)\n",script[1]); - return(false); + return eval->Invalid("unexpected OraclesValidate funcid"); break; } } diff --git a/src/cc/rewards.cpp b/src/cc/rewards.cpp index 1f3408252..99046e51c 100644 --- a/src/cc/rewards.cpp +++ b/src/cc/rewards.cpp @@ -289,7 +289,7 @@ bool RewardsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &t break; default: fprintf(stderr,"illegal rewards funcid.(%c)\n",funcid); - return(false); + return eval->Invalid("unexpected rewards funcid"); break; } }