aboutsummaryrefslogtreecommitdiffstats
path: root/eth/backend.go
diff options
context:
space:
mode:
Diffstat (limited to 'eth/backend.go')
-rw-r--r--eth/backend.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 4bc00edde..dc592e7fc 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -45,6 +45,7 @@ import (
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/nat"
+ "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/whisper"
)
@@ -80,6 +81,7 @@ type Config struct {
BlockChainVersion int
SkipBcVersionCheck bool // e.g. blockchain export
+ DatabaseCache int
DataDir string
LogFile string
@@ -261,7 +263,7 @@ func New(config *Config) (*Ethereum, error) {
newdb := config.NewDB
if newdb == nil {
- newdb = func(path string) (common.Database, error) { return ethdb.NewLDBDatabase(path) }
+ newdb = func(path string) (common.Database, error) { return ethdb.NewLDBDatabase(path, config.DatabaseCache) }
}
blockDb, err := newdb(filepath.Join(config.DataDir, "blockchain"))
if err != nil {
@@ -367,6 +369,13 @@ func New(config *Config) (*Ethereum, error) {
eth.miner = miner.New(eth, eth.EventMux(), eth.pow)
eth.miner.SetGasPrice(config.GasPrice)
+
+ extra := config.Name
+ if uint64(len(extra)) > params.MaximumExtraDataSize.Uint64() {
+ extra = extra[:params.MaximumExtraDataSize.Uint64()]
+ }
+ eth.miner.SetExtra([]byte(extra))
+
if config.Shh {
eth.whisper = whisper.New()
eth.shhVersionId = int(eth.whisper.Version())