Remove voutsum overflow check, rely on monotonicity

This commit is contained in:
jl777
2019-03-03 05:08:09 -11:00
parent 32496bcab2
commit 12b23c595d
2 changed files with 6 additions and 5 deletions

View File

@@ -1480,7 +1480,7 @@ bool rogue_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const C
if ( e == EVAL_ROGUE ) if ( e == EVAL_ROGUE )
{ {
//fprintf(stderr,"ht.%d rogue.(%c)\n",height,script[1]); //fprintf(stderr,"ht.%d rogue.(%c)\n",height,script[1]);
if ( decoded == 0 ) //if ( decoded == 0 )
{ {
switch ( funcid ) switch ( funcid )
{ {

View File

@@ -3373,8 +3373,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
int64_t nTimeStart = GetTimeMicros(); int64_t nTimeStart = GetTimeMicros();
CAmount nFees = 0; CAmount nFees = 0;
int nInputs = 0; int nInputs = 0;
uint64_t voutsum = 0,prevsum=0,valueout; uint64_t valueout;
int64_t interest,sum = 0; int64_t voutsum = 0,prevsum=0,interest,sum = 0;
unsigned int nSigOps = 0; unsigned int nSigOps = 0;
CDiskTxPos pos(pindex->GetBlockPos(), GetSizeOfCompactSize(block.vtx.size())); CDiskTxPos pos(pindex->GetBlockPos(), GetSizeOfCompactSize(block.vtx.size()));
std::vector<std::pair<uint256, CDiskTxPos> > vPos; std::vector<std::pair<uint256, CDiskTxPos> > vPos;
@@ -3501,12 +3501,13 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
} }
prevsum = voutsum; prevsum = voutsum;
voutsum += valueout; voutsum += valueout;
if ( KOMODO_VALUETOOBIG(voutsum) != 0 ) /*if ( KOMODO_VALUETOOBIG(voutsum) != 0 )
{ {
fprintf(stderr,"voutsum %.8f too big\n",(double)voutsum/COIN); fprintf(stderr,"voutsum %.8f too big\n",(double)voutsum/COIN);
return state.DoS(100, error("ConnectBlock(): voutsum too big"),REJECT_INVALID,"tx valueout is too big"); return state.DoS(100, error("ConnectBlock(): voutsum too big"),REJECT_INVALID,"tx valueout is too big");
} }
else if ( voutsum < prevsum ) else*/
if ( voutsum < prevsum )
return state.DoS(100, error("ConnectBlock(): voutsum less after adding valueout"),REJECT_INVALID,"tx valueout is too big"); return state.DoS(100, error("ConnectBlock(): voutsum less after adding valueout"),REJECT_INVALID,"tx valueout is too big");
if (!tx.IsCoinBase()) if (!tx.IsCoinBase())
{ {