• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revision5764f1cfc4b360655647c5c9bff3982e03679ff7 (tree)
Time2019-07-17 11:24:10
Authoroys <oys@oysd...>
Commiteroys

Log Message

optimise

Change Summary

Incremental Difference

--- a/protocol/validation/tx.go
+++ b/protocol/validation/tx.go
@@ -63,8 +63,10 @@ func (g *GasState) setGas(BTMValue int64, txSize int64) error {
6363 return errors.Wrap(ErrGasCalculate, "setGas calc gas amount")
6464 }
6565
66- // set tx free gas
67- g.GasLeft += consensus.ActiveNetParams.DefaultGasCredit
66+ if g.GasLeft, ok = checked.AddInt64(g.GasLeft, consensus.ActiveNetParams.DefaultGasCredit); !ok {
67+ return errors.Wrap(ErrGasCalculate, "setGas calc free gas")
68+ }
69+
6870 if g.GasLeft > consensus.ActiveNetParams.MaxGasAmount {
6971 g.GasLeft = consensus.ActiveNetParams.MaxGasAmount
7072 }
Show on old repository browser