}
g.BTMValue = uint64(BTMValue)
-
var ok bool
if g.GasLeft, ok = checked.DivInt64(BTMValue, consensus.ActiveNetParams.VMGasRate); !ok {
return errors.Wrap(ErrGasCalculate, "setGas calc gas amount")
}
+ if g.GasLeft, ok = checked.AddInt64(g.GasLeft, consensus.ActiveNetParams.DefaultGasCredit); !ok {
+ return errors.Wrap(ErrGasCalculate, "setGas calc free gas")
+ }
+
if g.GasLeft > consensus.ActiveNetParams.MaxGasAmount {
g.GasLeft = consensus.ActiveNetParams.MaxGasAmount
}
parity[*dest.Value.AssetId] = diff
}
+ btmAmount := int64(0)
for assetID, amount := range parity {
if assetID == *consensus.BTMAssetID {
- if err = vs.gasStatus.setGas(amount, int64(vs.tx.SerializedSize)); err != nil {
- return err
- }
+ btmAmount = amount
} else if amount != 0 {
return errors.WithDetailf(ErrUnbalanced, "asset %x sources - destinations = %d (should be 0)", assetID.Bytes(), amount)
}
}
+ if err = vs.gasStatus.setGas(btmAmount, int64(vs.tx.SerializedSize)); err != nil {
+ return err
+ }
+
for _, BTMInputID := range vs.tx.GasInputIDs {
e, ok := vs.tx.Entries[BTMInputID]
if !ok {