Skip to content

Commit

Permalink
Sync upstream comment and error improvements.
Browse files Browse the repository at this point in the history
Upstream commits:
- 756f58b
- 23bcb36
  • Loading branch information
davecgh committed May 21, 2016
2 parents 85d85e8 + 23bcb36 commit e8e81fe
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions blockchain/validate.go
Expand Up @@ -157,13 +157,14 @@ func CheckTransactionSanity(tx *dcrutil.Tx, params *chaincfg.Params) error {
return ruleError(ErrBadTxOutValue, str)
}

// TODO(davec): No need to check < 0 here as atom is
// guaranteed to be positive per the above check. Also need
// to add overflow checks.
// Two's complement int64 overflow guarantees that any overflow
// is detected and reported. This is impossible for Decred, but
// perhaps possible if an alt increases the total money supply.
totalAtom += atom
if totalAtom < 0 {
str := fmt.Sprintf("total value of all transaction "+
"outputs has negative value of %v", totalAtom)
"outputs exceeds max allowed value of %v",
dcrutil.MaxAmount)
return ruleError(ErrBadTxOutValue, str)
}
if totalAtom > dcrutil.MaxAmount {
Expand Down

0 comments on commit e8e81fe

Please sign in to comment.