aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/geth/main.go3
-rw-r--r--cmd/utils/flags.go16
2 files changed, 14 insertions, 5 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index a8649a304..6ff3b3781 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -281,6 +281,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.BootnodesFlag,
utils.DataDirFlag,
utils.BlockchainVersionFlag,
+ utils.CacheFlag,
utils.JSpathFlag,
utils.ListenPortFlag,
utils.MaxPeersFlag,
@@ -501,7 +502,7 @@ func blockRecovery(ctx *cli.Context) {
cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx)
utils.CheckLegalese(cfg.DataDir)
- blockDb, err := ethdb.NewLDBDatabase(filepath.Join(cfg.DataDir, "blockchain"))
+ blockDb, err := ethdb.NewLDBDatabase(filepath.Join(cfg.DataDir, "blockchain"), cfg.DatabaseCache)
if err != nil {
glog.Fatalln("could not open db:", err)
}
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 73bdb935a..68de67cde 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -126,6 +126,11 @@ var (
Name: "natspec",
Usage: "Enable NatSpec confirmation notice",
}
+ CacheFlag = cli.IntFlag{
+ Name: "cache",
+ Usage: "Megabytes of memory allocated to internal caching",
+ Value: 0,
+ }
// miner settings
MinerThreadsFlag = cli.IntFlag{
@@ -384,6 +389,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
GenesisNonce: ctx.GlobalInt(GenesisNonceFlag.Name),
GenesisFile: ctx.GlobalString(GenesisFileFlag.Name),
BlockChainVersion: ctx.GlobalInt(BlockchainVersionFlag.Name),
+ DatabaseCache: ctx.GlobalInt(CacheFlag.Name),
SkipBcVersionCheck: false,
NetworkId: ctx.GlobalInt(NetworkIdFlag.Name),
LogFile: ctx.GlobalString(LogFileFlag.Name),
@@ -425,15 +431,17 @@ func SetupLogger(ctx *cli.Context) {
// MakeChain creates a chain manager from set command line flags.
func MakeChain(ctx *cli.Context) (chain *core.ChainManager, blockDB, stateDB, extraDB common.Database) {
- dd := ctx.GlobalString(DataDirFlag.Name)
+ datadir := ctx.GlobalString(DataDirFlag.Name)
+ cache := ctx.GlobalInt(CacheFlag.Name)
+
var err error
- if blockDB, err = ethdb.NewLDBDatabase(filepath.Join(dd, "blockchain")); err != nil {
+ if blockDB, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "blockchain"), cache); err != nil {
Fatalf("Could not open database: %v", err)
}
- if stateDB, err = ethdb.NewLDBDatabase(filepath.Join(dd, "state")); err != nil {
+ if stateDB, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "state"), cache); err != nil {
Fatalf("Could not open database: %v", err)
}
- if extraDB, err = ethdb.NewLDBDatabase(filepath.Join(dd, "extra")); err != nil {
+ if extraDB, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "extra"), cache); err != nil {
Fatalf("Could not open database: %v", err)
}