mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
add comments
This commit is contained in:
parent
f7a990189b
commit
f5100f8f43
2 changed files with 11 additions and 3 deletions
|
|
@ -40,10 +40,10 @@ type DumpAccount struct {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dump represents the full dump in a collected format, as one large map
|
// Dump represents the full state tire dump in a collected format, as one large map (jmlee)
|
||||||
type Dump struct {
|
type Dump struct {
|
||||||
Root string `json:"root"`
|
Root string `json:"root"` // state trie's root hash (jmlee)
|
||||||
Accounts map[common.Address]DumpAccount `json:"accounts"`
|
Accounts map[common.Address]DumpAccount `json:"accounts"` // all accounts in state trie (jmlee)
|
||||||
}
|
}
|
||||||
|
|
||||||
// iterativeDump is a 'collector'-implementation which dump output line-by-line iteratively
|
// iterativeDump is a 'collector'-implementation which dump output line-by-line iteratively
|
||||||
|
|
@ -55,10 +55,12 @@ type collector interface {
|
||||||
onAccount(common.Address, DumpAccount)
|
onAccount(common.Address, DumpAccount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// onRoot sets Dump.Root field (jmlee)
|
||||||
func (self *Dump) onRoot(root common.Hash) {
|
func (self *Dump) onRoot(root common.Hash) {
|
||||||
self.Root = fmt.Sprintf("%x", root)
|
self.Root = fmt.Sprintf("%x", root)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// onAccount inserts account into Dump.Accounts map field (jmlee)
|
||||||
func (self *Dump) onAccount(addr common.Address, account DumpAccount) {
|
func (self *Dump) onAccount(addr common.Address, account DumpAccount) {
|
||||||
self.Accounts[addr] = account
|
self.Accounts[addr] = account
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import (
|
||||||
"github.com/eth4nos/go-ethereum/core/rawdb"
|
"github.com/eth4nos/go-ethereum/core/rawdb"
|
||||||
"github.com/eth4nos/go-ethereum/ethdb"
|
"github.com/eth4nos/go-ethereum/ethdb"
|
||||||
"github.com/eth4nos/go-ethereum/event"
|
"github.com/eth4nos/go-ethereum/event"
|
||||||
|
"github.com/eth4nos/go-ethereum/log"
|
||||||
"github.com/eth4nos/go-ethereum/p2p"
|
"github.com/eth4nos/go-ethereum/p2p"
|
||||||
"github.com/eth4nos/go-ethereum/rpc"
|
"github.com/eth4nos/go-ethereum/rpc"
|
||||||
)
|
)
|
||||||
|
|
@ -53,8 +54,13 @@ func (ctx *ServiceContext) OpenDatabase(name string, cache int, handles int, nam
|
||||||
// also attaching a chain freezer to it that moves ancient chain data from the
|
// also attaching a chain freezer to it that moves ancient chain data from the
|
||||||
// database to immutable append-only files. If the node is an ephemeral one, a
|
// database to immutable append-only files. If the node is an ephemeral one, a
|
||||||
// memory database is returned.
|
// memory database is returned.
|
||||||
|
// (if user set datadir, then open or load leveldb. if not, then open new memorydb) (jmlee)
|
||||||
func (ctx *ServiceContext) OpenDatabaseWithFreezer(name string, cache int, handles int, freezer string, namespace string) (ethdb.Database, error) {
|
func (ctx *ServiceContext) OpenDatabaseWithFreezer(name string, cache int, handles int, freezer string, namespace string) (ethdb.Database, error) {
|
||||||
|
log.Info("\n### OpenDatabaseWithFreezer function executed ###\n")
|
||||||
|
log.Info("show params", "ctx.config.DataDir", ctx.config.DataDir, "freezer:", freezer) // (jmlee)
|
||||||
|
|
||||||
if ctx.config.DataDir == "" {
|
if ctx.config.DataDir == "" {
|
||||||
|
log.Info("### memory db opened!\n") // (jmlee)
|
||||||
return rawdb.NewMemoryDatabase(), nil
|
return rawdb.NewMemoryDatabase(), nil
|
||||||
}
|
}
|
||||||
root := ctx.config.ResolvePath(name)
|
root := ctx.config.ResolvePath(name)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue