Stricter player data validation

This commit is contained in:
jl777
2019-03-13 01:58:40 -11:00
parent bd0c4f465d
commit 526beb964f

View File

@@ -1572,7 +1572,9 @@ bool rogue_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const C
return eval->Invalid("couldnt decode H/Q opret"); return eval->Invalid("couldnt decode H/Q opret");
} }
// verify pk belongs to this tx // verify pk belongs to this tx
if ( tokentx == 'c' && playerdata.size() > 0 ) if ( tokentx == 'c' )
{
if ( playerdata.size() > 0 )
{ {
static char laststr[512]; char cashstr[512]; static char laststr[512]; char cashstr[512];
if ( rogue_playerdata_validate(&cashout,ptxid,cp,playerdata,gametxid,pk) < 0 ) if ( rogue_playerdata_validate(&cashout,ptxid,cp,playerdata,gametxid,pk) < 0 )
@@ -1594,6 +1596,7 @@ bool rogue_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const C
strcpy(laststr,cashstr); strcpy(laststr,cashstr);
fprintf(stderr,"%s\n",cashstr); fprintf(stderr,"%s\n",cashstr);
} }
} else cashout = 10000;
if ( enabled != 0 && tx.vout[2].nValue != cashout ) if ( enabled != 0 && tx.vout[2].nValue != cashout )
return eval->Invalid("mismatched cashout amount"); return eval->Invalid("mismatched cashout amount");
} }