aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/state/state_object.go9
-rw-r--r--core/vm/evm.go53
2 files changed, 31 insertions, 31 deletions
diff --git a/core/state/state_object.go b/core/state/state_object.go
index 9772859..bbfff1d 100644
--- a/core/state/state_object.go
+++ b/core/state/state_object.go
@@ -94,7 +94,7 @@ type stateObject struct {
// empty returns whether the account is considered empty.
func (s *stateObject) empty() bool {
- return s.data.Nonce == 0 && s.data.Balance.Sign() == 0 && bytes.Equal(s.data.CodeHash, emptyCodeHash)
+ return s.data.Nonce == 0 && s.data.Balance.Sign() == 0 && bytes.Equal(s.data.CodeHash, emptyCodeHash) && !s.data.IsMultiCoin
}
// Account is the Ethereum consensus representation of accounts.
@@ -430,6 +430,7 @@ func (s *stateObject) SubBalanceMultiCoin(coinID common.Hash, amount *big.Int, d
}
func (s *stateObject) SetBalanceMultiCoin(coinID common.Hash, amount *big.Int, db Database) {
+ s.data.IsMultiCoin = true
NormalizeCoinID(&coinID)
s.SetState(db, coinID, common.BigToHash(amount))
}
@@ -566,9 +567,9 @@ func (s *stateObject) BalanceMultiCoin(coinID common.Hash, db Database) *big.Int
// return true
//}
-func (s *stateObject) IsMultiCoin() bool {
- return s.data.IsMultiCoin
-}
+//func (s *stateObject) IsMultiCoin() bool {
+// return s.data.IsMultiCoin
+//}
func (s *stateObject) Nonce() uint64 {
return s.data.Nonce
diff --git a/core/vm/evm.go b/core/vm/evm.go
index e895211..54c9c7f 100644
--- a/core/vm/evm.go
+++ b/core/vm/evm.go
@@ -280,8 +280,7 @@ func (evm *EVM) CallExpert(caller ContractRef, addr common.Address, input []byte
return nil, gas, ErrInsufficientBalance
}
- var to = AccountRef(addr)
- mcerr := evm.Context.CanTransferMC(evm.StateDB, caller.Address(), to.Address(), coinID, value2)
+ mcerr := evm.Context.CanTransferMC(evm.StateDB, caller.Address(), addr, coinID, value2)
if mcerr == 1 {
return nil, gas, ErrInsufficientBalance
} else if mcerr != 0 {
@@ -289,17 +288,17 @@ func (evm *EVM) CallExpert(caller ContractRef, addr common.Address, input []byte
}
snapshot := evm.StateDB.Snapshot()
- p, isPrecompile := evm.precompile(addr)
+ //p, isPrecompile := evm.precompile(addr)
if !evm.StateDB.Exist(addr) {
- if !isPrecompile && evm.chainRules.IsEIP158 && value.Sign() == 0 {
- // Calling a non existing account, don't do anything, but ping the tracer
- if evm.vmConfig.Debug && evm.depth == 0 {
- evm.vmConfig.Tracer.CaptureStart(caller.Address(), addr, false, input, gas, value)
- evm.vmConfig.Tracer.CaptureEnd(ret, 0, 0, nil)
- }
- return nil, gas, nil
- }
+ //if !isPrecompile && evm.chainRules.IsEIP158 && value.Sign() == 0 {
+ // // Calling a non existing account, don't do anything, but ping the tracer
+ // if evm.vmConfig.Debug && evm.depth == 0 {
+ // evm.vmConfig.Tracer.CaptureStart(caller.Address(), addr, false, input, gas, value)
+ // evm.vmConfig.Tracer.CaptureEnd(ret, 0, 0, nil)
+ // }
+ // return nil, gas, nil
+ //}
evm.StateDB.CreateAccount(addr)
}
evm.Transfer(evm.StateDB, caller.Address(), addr, value)
@@ -313,24 +312,24 @@ func (evm *EVM) CallExpert(caller ContractRef, addr common.Address, input []byte
}(gas, time.Now())
}
- if isPrecompile {
- ret, gas, err = RunPrecompiledContract(p, input, gas)
+ //if isPrecompile {
+ // ret, gas, err = RunPrecompiledContract(p, input, gas)
+ //} else {
+ // Initialise a new contract and set the code that is to be used by the EVM.
+ // The contract is a scoped environment for this execution context only.
+ code := evm.StateDB.GetCode(addr)
+ if len(code) == 0 {
+ ret, err = nil, nil // gas is unchanged
} else {
- // Initialise a new contract and set the code that is to be used by the EVM.
- // The contract is a scoped environment for this execution context only.
- code := evm.StateDB.GetCode(addr)
- if len(code) == 0 {
- ret, err = nil, nil // gas is unchanged
- } else {
- addrCopy := addr
- // If the account has no code, we can abort here
- // The depth-check is already done, and precompiles handled above
- contract := NewContract(caller, AccountRef(addrCopy), value, gas)
- contract.SetCallCode(&addrCopy, evm.StateDB.GetCodeHash(addrCopy), code)
- ret, err = run(evm, contract, input, false)
- gas = contract.Gas
- }
+ addrCopy := addr
+ // If the account has no code, we can abort here
+ // The depth-check is already done, and precompiles handled above
+ contract := NewContract(caller, AccountRef(addrCopy), value, gas)
+ contract.SetCallCode(&addrCopy, evm.StateDB.GetCodeHash(addrCopy), code)
+ ret, err = run(evm, contract, input, false)
+ gas = contract.Gas
}
+ //}
// When an error was returned by the EVM or when setting the creation code
// above we revert to the snapshot and consume any gas remaining. Additionally
// when we're in homestead this also counts for code storage gas errors.