2015-07-07 03:54:22 +03:00
|
|
|
// Copyright 2014 The go-ethereum Authors
|
2015-07-22 19:48:40 +03:00
|
|
|
// This file is part of the go-ethereum library.
|
2015-07-07 03:54:22 +03:00
|
|
|
//
|
2015-07-23 19:35:11 +03:00
|
|
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
2015-07-07 03:54:22 +03:00
|
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
2015-07-22 19:48:40 +03:00
|
|
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
2015-07-07 03:54:22 +03:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-07-22 19:48:40 +03:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2015-07-07 03:54:22 +03:00
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
2015-07-22 19:48:40 +03:00
|
|
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
2015-07-07 03:54:22 +03:00
|
|
|
|
2014-10-31 15:43:14 +02:00
|
|
|
package state
|
2014-08-06 10:53:00 +03:00
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
"time"
|
2014-08-06 10:53:00 +03:00
|
|
|
|
2015-03-16 12:27:38 +02:00
|
|
|
"github.com/ethereum/go-ethereum/common"
|
2019-06-24 17:16:44 +03:00
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
2021-09-28 11:48:07 +03:00
|
|
|
"github.com/ethereum/go-ethereum/core/types"
|
2019-06-24 17:16:44 +03:00
|
|
|
"github.com/ethereum/go-ethereum/log"
|
2016-09-22 22:04:58 +03:00
|
|
|
"github.com/ethereum/go-ethereum/rlp"
|
2017-04-18 14:37:10 +03:00
|
|
|
"github.com/ethereum/go-ethereum/trie"
|
2014-08-06 10:53:00 +03:00
|
|
|
)
|
|
|
|
|
2022-10-11 10:37:00 +03:00
|
|
|
// DumpConfig is a set of options to control what portions of the state will be
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
// iterated and collected.
|
|
|
|
type DumpConfig struct {
|
|
|
|
SkipCode bool
|
|
|
|
SkipStorage bool
|
|
|
|
OnlyWithAddresses bool
|
|
|
|
Start []byte
|
|
|
|
Max uint64
|
|
|
|
}
|
|
|
|
|
2020-06-30 11:12:51 +03:00
|
|
|
// DumpCollector interface which the state trie calls during iteration
|
|
|
|
type DumpCollector interface {
|
|
|
|
// OnRoot is called with the state root
|
|
|
|
OnRoot(common.Hash)
|
|
|
|
// OnAccount is called once for each account in the trie
|
2023-05-23 13:10:26 +03:00
|
|
|
OnAccount(*common.Address, DumpAccount)
|
2020-06-30 11:12:51 +03:00
|
|
|
}
|
|
|
|
|
2020-03-31 13:08:44 +03:00
|
|
|
// DumpAccount represents an account in the state.
|
2016-09-22 22:04:58 +03:00
|
|
|
type DumpAccount struct {
|
2019-06-24 17:16:44 +03:00
|
|
|
Balance string `json:"balance"`
|
|
|
|
Nonce uint64 `json:"nonce"`
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
Root hexutil.Bytes `json:"root"`
|
|
|
|
CodeHash hexutil.Bytes `json:"codeHash"`
|
|
|
|
Code hexutil.Bytes `json:"code,omitempty"`
|
2019-06-24 17:16:44 +03:00
|
|
|
Storage map[common.Hash]string `json:"storage,omitempty"`
|
|
|
|
Address *common.Address `json:"address,omitempty"` // Address only present in iterative (line-by-line) mode
|
|
|
|
SecureKey hexutil.Bytes `json:"key,omitempty"` // If we don't have address, we can output the key
|
|
|
|
|
2014-08-06 10:53:00 +03:00
|
|
|
}
|
|
|
|
|
2020-03-31 13:08:44 +03:00
|
|
|
// Dump represents the full dump in a collected format, as one large map.
|
2016-09-22 22:04:58 +03:00
|
|
|
type Dump struct {
|
2019-06-24 17:16:44 +03:00
|
|
|
Root string `json:"root"`
|
|
|
|
Accounts map[common.Address]DumpAccount `json:"accounts"`
|
|
|
|
}
|
|
|
|
|
2020-06-30 11:12:51 +03:00
|
|
|
// OnRoot implements DumpCollector interface
|
|
|
|
func (d *Dump) OnRoot(root common.Hash) {
|
|
|
|
d.Root = fmt.Sprintf("%x", root)
|
|
|
|
}
|
|
|
|
|
|
|
|
// OnAccount implements DumpCollector interface
|
2023-05-23 13:10:26 +03:00
|
|
|
func (d *Dump) OnAccount(addr *common.Address, account DumpAccount) {
|
|
|
|
if addr != nil {
|
|
|
|
d.Accounts[*addr] = account
|
|
|
|
}
|
2019-11-22 17:56:05 +03:00
|
|
|
}
|
2019-06-24 17:16:44 +03:00
|
|
|
|
2020-03-31 13:08:44 +03:00
|
|
|
// IteratorDump is an implementation for iterating over data.
|
|
|
|
type IteratorDump struct {
|
|
|
|
Root string `json:"root"`
|
|
|
|
Accounts map[common.Address]DumpAccount `json:"accounts"`
|
|
|
|
Next []byte `json:"next,omitempty"` // nil if no more accounts
|
|
|
|
}
|
|
|
|
|
2020-06-30 11:12:51 +03:00
|
|
|
// OnRoot implements DumpCollector interface
|
|
|
|
func (d *IteratorDump) OnRoot(root common.Hash) {
|
2019-11-22 17:56:05 +03:00
|
|
|
d.Root = fmt.Sprintf("%x", root)
|
2014-08-06 10:53:00 +03:00
|
|
|
}
|
|
|
|
|
2020-06-30 11:12:51 +03:00
|
|
|
// OnAccount implements DumpCollector interface
|
2023-05-23 13:10:26 +03:00
|
|
|
func (d *IteratorDump) OnAccount(addr *common.Address, account DumpAccount) {
|
|
|
|
if addr != nil {
|
|
|
|
d.Accounts[*addr] = account
|
|
|
|
}
|
2019-06-24 17:16:44 +03:00
|
|
|
}
|
2020-03-31 13:08:44 +03:00
|
|
|
|
2020-06-30 11:12:51 +03:00
|
|
|
// iterativeDump is a DumpCollector-implementation which dumps output line-by-line iteratively.
|
|
|
|
type iterativeDump struct {
|
|
|
|
*json.Encoder
|
2020-03-31 13:08:44 +03:00
|
|
|
}
|
2019-06-24 17:16:44 +03:00
|
|
|
|
2020-06-30 11:12:51 +03:00
|
|
|
// OnAccount implements DumpCollector interface
|
2023-05-23 13:10:26 +03:00
|
|
|
func (d iterativeDump) OnAccount(addr *common.Address, account DumpAccount) {
|
2019-06-24 17:16:44 +03:00
|
|
|
dumpAccount := &DumpAccount{
|
|
|
|
Balance: account.Balance,
|
|
|
|
Nonce: account.Nonce,
|
|
|
|
Root: account.Root,
|
|
|
|
CodeHash: account.CodeHash,
|
|
|
|
Code: account.Code,
|
|
|
|
Storage: account.Storage,
|
|
|
|
SecureKey: account.SecureKey,
|
2023-05-23 13:10:26 +03:00
|
|
|
Address: addr,
|
2014-08-06 10:53:00 +03:00
|
|
|
}
|
2019-11-22 17:56:05 +03:00
|
|
|
d.Encode(dumpAccount)
|
2019-06-24 17:16:44 +03:00
|
|
|
}
|
2019-11-22 17:56:05 +03:00
|
|
|
|
2020-06-30 11:12:51 +03:00
|
|
|
// OnRoot implements DumpCollector interface
|
|
|
|
func (d iterativeDump) OnRoot(root common.Hash) {
|
2019-11-22 17:56:05 +03:00
|
|
|
d.Encode(struct {
|
2019-06-24 17:16:44 +03:00
|
|
|
Root common.Hash `json:"root"`
|
|
|
|
}{root})
|
|
|
|
}
|
2014-08-06 10:53:00 +03:00
|
|
|
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
// DumpToCollector iterates the state according to the given options and inserts
|
|
|
|
// the items into a collector for aggregation or serialization.
|
|
|
|
func (s *StateDB) DumpToCollector(c DumpCollector, conf *DumpConfig) (nextKey []byte) {
|
|
|
|
// Sanitize the input to allow nil configs
|
|
|
|
if conf == nil {
|
|
|
|
conf = new(DumpConfig)
|
|
|
|
}
|
|
|
|
var (
|
|
|
|
missingPreimages int
|
|
|
|
accounts uint64
|
|
|
|
start = time.Now()
|
|
|
|
logged = time.Now()
|
|
|
|
)
|
|
|
|
log.Info("Trie dumping started", "root", s.trie.Hash())
|
2020-06-30 11:12:51 +03:00
|
|
|
c.OnRoot(s.trie.Hash())
|
2020-03-31 13:08:44 +03:00
|
|
|
|
cmd, core/state, eth, tests, trie: improve state reader (#27428)
The state availability is checked during the creation of a state reader.
- In hash-based database, if the specified root node does not exist on disk disk, then
the state reader won't be created and an error will be returned.
- In path-based database, if the specified state layer is not available, then the
state reader won't be created and an error will be returned.
This change also contains a stricter semantics regarding the `Commit` operation: once it has been performed, the trie is no longer usable, and certain operations will return an error.
2023-06-20 22:31:45 +03:00
|
|
|
trieIt, err := s.trie.NodeIterator(conf.Start)
|
|
|
|
if err != nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
it := trie.NewIterator(trieIt)
|
2014-12-23 19:35:36 +02:00
|
|
|
for it.Next() {
|
2021-09-28 11:48:07 +03:00
|
|
|
var data types.StateAccount
|
2016-09-22 22:04:58 +03:00
|
|
|
if err := rlp.DecodeBytes(it.Value, &data); err != nil {
|
2016-04-15 12:16:56 +03:00
|
|
|
panic(err)
|
|
|
|
}
|
2016-09-22 22:04:58 +03:00
|
|
|
account := DumpAccount{
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
Balance: data.Balance.String(),
|
|
|
|
Nonce: data.Nonce,
|
|
|
|
Root: data.Root[:],
|
|
|
|
CodeHash: data.CodeHash,
|
|
|
|
SecureKey: it.Key,
|
2016-04-15 12:16:56 +03:00
|
|
|
}
|
2023-05-23 13:10:26 +03:00
|
|
|
var (
|
|
|
|
addrBytes = s.trie.GetKey(it.Key)
|
|
|
|
addr = common.BytesToAddress(addrBytes)
|
|
|
|
address *common.Address
|
|
|
|
)
|
2020-05-07 16:06:31 +03:00
|
|
|
if addrBytes == nil {
|
2019-06-24 17:16:44 +03:00
|
|
|
// Preimage missing
|
|
|
|
missingPreimages++
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
if conf.OnlyWithAddresses {
|
2019-06-24 17:16:44 +03:00
|
|
|
continue
|
|
|
|
}
|
2023-05-23 13:10:26 +03:00
|
|
|
} else {
|
|
|
|
address = &addr
|
2019-06-24 17:16:44 +03:00
|
|
|
}
|
2023-07-11 16:43:23 +03:00
|
|
|
obj := newObject(s, addr, &data)
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
if !conf.SkipCode {
|
2023-07-24 13:22:09 +03:00
|
|
|
account.Code = obj.Code()
|
2019-06-24 17:16:44 +03:00
|
|
|
}
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
if !conf.SkipStorage {
|
2019-06-24 17:16:44 +03:00
|
|
|
account.Storage = make(map[common.Hash]string)
|
2023-07-24 13:22:09 +03:00
|
|
|
tr, err := obj.getTrie()
|
2022-12-21 12:21:21 +03:00
|
|
|
if err != nil {
|
|
|
|
log.Error("Failed to load storage trie", "err", err)
|
|
|
|
continue
|
|
|
|
}
|
cmd, core/state, eth, tests, trie: improve state reader (#27428)
The state availability is checked during the creation of a state reader.
- In hash-based database, if the specified root node does not exist on disk disk, then
the state reader won't be created and an error will be returned.
- In path-based database, if the specified state layer is not available, then the
state reader won't be created and an error will be returned.
This change also contains a stricter semantics regarding the `Commit` operation: once it has been performed, the trie is no longer usable, and certain operations will return an error.
2023-06-20 22:31:45 +03:00
|
|
|
trieIt, err := tr.NodeIterator(nil)
|
|
|
|
if err != nil {
|
|
|
|
log.Error("Failed to create trie iterator", "err", err)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
storageIt := trie.NewIterator(trieIt)
|
2019-06-24 17:16:44 +03:00
|
|
|
for storageIt.Next() {
|
2019-08-12 17:14:40 +03:00
|
|
|
_, content, _, err := rlp.Split(storageIt.Value)
|
|
|
|
if err != nil {
|
|
|
|
log.Error("Failed to decode the value returned by iterator", "error", err)
|
|
|
|
continue
|
|
|
|
}
|
2019-11-22 17:56:05 +03:00
|
|
|
account.Storage[common.BytesToHash(s.trie.GetKey(storageIt.Key))] = common.Bytes2Hex(content)
|
2019-06-24 17:16:44 +03:00
|
|
|
}
|
2014-12-23 19:35:36 +02:00
|
|
|
}
|
2023-05-23 13:10:26 +03:00
|
|
|
c.OnAccount(address, account)
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
accounts++
|
|
|
|
if time.Since(logged) > 8*time.Second {
|
|
|
|
log.Info("Trie dumping in progress", "at", it.Key, "accounts", accounts,
|
|
|
|
"elapsed", common.PrettyDuration(time.Since(start)))
|
|
|
|
logged = time.Now()
|
|
|
|
}
|
|
|
|
if conf.Max > 0 && accounts >= conf.Max {
|
2020-03-31 13:08:44 +03:00
|
|
|
if it.Next() {
|
|
|
|
nextKey = it.Key
|
|
|
|
}
|
|
|
|
break
|
|
|
|
}
|
2019-06-24 17:16:44 +03:00
|
|
|
}
|
|
|
|
if missingPreimages > 0 {
|
|
|
|
log.Warn("Dump incomplete due to missing preimages", "missing", missingPreimages)
|
|
|
|
}
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
log.Info("Trie dumping complete", "accounts", accounts,
|
|
|
|
"elapsed", common.PrettyDuration(time.Since(start)))
|
2020-03-31 13:08:44 +03:00
|
|
|
|
|
|
|
return nextKey
|
2019-06-24 17:16:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// RawDump returns the entire state an a single large object
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
func (s *StateDB) RawDump(opts *DumpConfig) Dump {
|
2019-06-24 17:16:44 +03:00
|
|
|
dump := &Dump{
|
|
|
|
Accounts: make(map[common.Address]DumpAccount),
|
2014-12-23 19:35:36 +02:00
|
|
|
}
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
s.DumpToCollector(dump, opts)
|
2019-06-24 17:16:44 +03:00
|
|
|
return *dump
|
2015-02-28 20:15:57 +02:00
|
|
|
}
|
2014-08-06 10:53:00 +03:00
|
|
|
|
2019-06-24 17:16:44 +03:00
|
|
|
// Dump returns a JSON string representing the entire state as a single json-object
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
func (s *StateDB) Dump(opts *DumpConfig) []byte {
|
|
|
|
dump := s.RawDump(opts)
|
2019-06-24 17:16:44 +03:00
|
|
|
json, err := json.MarshalIndent(dump, "", " ")
|
2014-08-06 10:53:00 +03:00
|
|
|
if err != nil {
|
2020-06-30 11:12:51 +03:00
|
|
|
fmt.Println("Dump err", err)
|
2014-08-06 10:53:00 +03:00
|
|
|
}
|
2014-08-17 13:42:32 +03:00
|
|
|
return json
|
2014-08-06 10:53:00 +03:00
|
|
|
}
|
2019-06-24 17:16:44 +03:00
|
|
|
|
|
|
|
// IterativeDump dumps out accounts as json-objects, delimited by linebreaks on stdout
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
func (s *StateDB) IterativeDump(opts *DumpConfig, output *json.Encoder) {
|
|
|
|
s.DumpToCollector(iterativeDump{output}, opts)
|
2020-03-31 13:08:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// IteratorDump dumps out a batch of accounts starts with the given start key
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
func (s *StateDB) IteratorDump(opts *DumpConfig) IteratorDump {
|
2020-03-31 13:08:44 +03:00
|
|
|
iterator := &IteratorDump{
|
|
|
|
Accounts: make(map[common.Address]DumpAccount),
|
|
|
|
}
|
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
|
|
|
iterator.Next = s.DumpToCollector(iterator, opts)
|
2020-03-31 13:08:44 +03:00
|
|
|
return *iterator
|
2019-06-24 17:16:44 +03:00
|
|
|
}
|