diff --git a/core/state/statedb.go b/core/state/statedb.go index e8b86ae26c..74f2e9518a 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -1484,16 +1484,3 @@ func (s *StateDB) PointCache() *utils.PointCache { func (s *StateDB) Witness() *stateless.Witness { return s.witness } - -func (s *StateDB) MoveAccount(from, to common.Address) error { - fromObj := s.getStateObject(from) - if fromObj == nil { - return fmt.Errorf("account %s not found", from.Hex()) - } - - fromObj.address = to - fromObj.addrHash = crypto.Keccak256Hash(to[:]) - - s.setStateObject(fromObj) - return nil -} diff --git a/core/state/statedb_test.go b/core/state/statedb_test.go index 6c1f617ded..2ce2b868fa 100644 --- a/core/state/statedb_test.go +++ b/core/state/statedb_test.go @@ -44,7 +44,6 @@ import ( "github.com/ethereum/go-ethereum/triedb/hashdb" "github.com/ethereum/go-ethereum/triedb/pathdb" "github.com/holiman/uint256" - "github.com/stretchr/testify/require" ) // Tests that updating a state trie does not leak any database writes prior to @@ -1374,40 +1373,3 @@ func TestStorageDirtiness(t *testing.T) { state.RevertToSnapshot(snap) checkDirty(common.Hash{0x1}, common.Hash{0x1}, true) } - -func TestMoveStorage(t *testing.T) { - var ( - disk = rawdb.NewMemoryDatabase() - tdb = triedb.NewDatabase(disk, nil) - db = NewDatabaseWithNodeDB(disk, tdb) - snaps, _ = snapshot.New(snapshot.Config{CacheSize: 10}, disk, tdb, types.EmptyRootHash) - state, _ = New(types.EmptyRootHash, db, snaps) - from = common.HexToAddress("0x1") - to = common.HexToAddress("0x2") - slotA = common.HexToHash("0x11") - valueA = common.HexToHash("0x111") - slotB = common.HexToHash("0x22") - valueB = common.HexToHash("0x222") - balance = uint256.NewInt(123) - ) - - var dummyReason tracing.BalanceChangeReason = 250 - state.SetBalance(from, balance, dummyReason) - state.SetState(from, slotA, valueA) - state.SetState(from, slotB, valueB) - - root, _ := state.Commit(0, true) - - require.True(t, state.Empty(to)) - - err := state.MoveAccount(from, to) - require.NoError(t, err) - - require.False(t, state.Empty(to)) - require.Equal(t, balance, state.GetBalance(to)) - require.Equal(t, valueA, state.GetState(to, slotA)) - require.Equal(t, valueB, state.GetState(to, slotB)) - - root2, _ := state.Commit(1, true) - require.NotEqual(t, root, root2) -}