diff options
author | Determinant <[email protected]> | 2020-09-16 22:54:37 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-09-16 22:54:37 -0400 |
commit | ed839907e592ad25e6119e145e7e05ca78b00fcd (patch) | |
tree | 1235df2fcf794c391afb33cc2dd80926469e2c7e /core/vm | |
parent | 5370b602abea0415f7609f19e3f44d5c9366e5bd (diff) |
...
Diffstat (limited to 'core/vm')
-rw-r--r-- | core/vm/evm.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/vm/evm.go b/core/vm/evm.go index 85b7ba7..e895211 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -275,17 +275,19 @@ func (evm *EVM) CallExpert(caller ContractRef, addr common.Address, input []byte return nil, gas, ErrDepth } - mcerr := evm.Context.CanTransferMC(evm.StateDB, caller.Address(), addr, coinID, value2) + // Fail if we're trying to transfer more than the available balance + if value.Sign() != 0 && !evm.Context.CanTransfer(evm.StateDB, caller.Address(), value) { + return nil, gas, ErrInsufficientBalance + } + + var to = AccountRef(addr) + mcerr := evm.Context.CanTransferMC(evm.StateDB, caller.Address(), to.Address(), coinID, value2) if mcerr == 1 { return nil, gas, ErrInsufficientBalance } else if mcerr != 0 { return nil, gas, ErrIncompatibleAccount } - // Fail if we're trying to transfer more than the available balance - if value.Sign() != 0 && !evm.Context.CanTransfer(evm.StateDB, caller.Address(), value) { - return nil, gas, ErrInsufficientBalance - } snapshot := evm.StateDB.Snapshot() p, isPrecompile := evm.precompile(addr) |