mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core/state: address review concerns
This commit is contained in:
parent
7331a12077
commit
016678e120
1 changed files with 22 additions and 26 deletions
|
|
@ -23,7 +23,6 @@ import (
|
|||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
|
|
@ -57,7 +56,7 @@ type DumpAccount struct {
|
|||
Code hexutil.Bytes `json:"code,omitempty"`
|
||||
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
|
||||
AddressHash hexutil.Bytes `json:"key,omitempty"` // If we don't have address, we can output the key
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +77,7 @@ func (d *Dump) OnRoot(root common.Hash) {
|
|||
// OnAccount implements DumpCollector interface
|
||||
func (d *Dump) OnAccount(addr *common.Address, account DumpAccount) {
|
||||
if addr == nil {
|
||||
d.Accounts[fmt.Sprintf("pre(%s)", account.SecureKey)] = account
|
||||
d.Accounts[fmt.Sprintf("pre(%s)", account.AddressHash)] = account
|
||||
}
|
||||
if addr != nil {
|
||||
d.Accounts[(*addr).String()] = account
|
||||
|
|
@ -99,7 +98,7 @@ func (d iterativeDump) OnAccount(addr *common.Address, account DumpAccount) {
|
|||
CodeHash: account.CodeHash,
|
||||
Code: account.Code,
|
||||
Storage: account.Storage,
|
||||
SecureKey: account.SecureKey,
|
||||
AddressHash: account.AddressHash,
|
||||
Address: addr,
|
||||
}
|
||||
d.Encode(dumpAccount)
|
||||
|
|
@ -144,15 +143,12 @@ func (s *StateDB) DumpToCollector(c DumpCollector, conf *DumpConfig) (nextKey []
|
|||
Nonce: data.Nonce,
|
||||
Root: data.Root[:],
|
||||
CodeHash: data.CodeHash,
|
||||
SecureKey: it.Key,
|
||||
AddressHash: it.Key,
|
||||
}
|
||||
address *common.Address
|
||||
addr common.Address
|
||||
addrBytes = s.trie.GetKey(it.Key)
|
||||
)
|
||||
if addrBytes == nil { // Preimage not present in memory. Check database.
|
||||
addrBytes = rawdb.ReadPreimage(s.Database().DiskDB(), common.BytesToHash(it.Key))
|
||||
}
|
||||
if addrBytes == nil {
|
||||
missingPreimages++
|
||||
if conf.OnlyWithAddresses {
|
||||
|
|
|
|||
Loading…
Reference in a new issue