From fbe0f2d6b14d7b6fc43068e224412d4e65176550 Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 30 Jun 2020 20:56:12 -0400 Subject: test multi-coin smart contracts --- core/state/statedb.go | 3 ++- core/state_transition.go | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/state/statedb.go b/core/state/statedb.go index 1d3207d..9c7535b 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -41,6 +41,7 @@ type revision struct { var ( // emptyRoot is the known root hash of an empty trie. emptyRoot = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421") + zeroRoot = common.HexToHash("0000000000000000000000000000000000000000000000000000000000000000") // emptyCode is the known hash of the empty EVM bytecode. emptyCode = crypto.Keccak256Hash(nil) @@ -239,7 +240,7 @@ func (self *StateDB) GetBalanceMultiCoin(addr common.Address, coinID common.Hash func (self *StateDB) EnableMultiCoin(addr common.Address) error { stateObject := self.GetOrNewStateObject(addr) - if stateObject.data.Root != emptyRoot { + if stateObject.data.Root != emptyRoot && stateObject.data.Root != zeroRoot { return errors.New("not a fresh account") } if !stateObject.EnableMultiCoin() { diff --git a/core/state_transition.go b/core/state_transition.go index 139289f..7a48597 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -219,7 +219,6 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo if contractCreation { ret, _, st.gas, vmerr = evm.Create(sender, st.data, st.gas, st.value) } else { - log.Debug("here2") // Increment the nonce for the next transaction st.state.SetNonce(msg.From(), st.state.GetNonce(sender.Address())+1) ret, st.gas, vmerr = evm.CallExpert(sender, st.to(), st.data, st.gas, st.value, st.coinID, st.value2) -- cgit v1.2.3-70-g09d2