github.com/m3shine/gochain@v2.2.26+incompatible/eth/config.go (about)

     1  // Copyright 2017 The go-ethereum Authors
     2  // This file is part of the go-ethereum library.
     3  //
     4  // The go-ethereum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-ethereum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package eth
    18  
    19  import (
    20  	"math/big"
    21  	"time"
    22  
    23  	"github.com/gochain-io/gochain/common"
    24  	"github.com/gochain-io/gochain/common/hexutil"
    25  	"github.com/gochain-io/gochain/core"
    26  	"github.com/gochain-io/gochain/eth/downloader"
    27  	"github.com/gochain-io/gochain/eth/gasprice"
    28  	"github.com/gochain-io/gochain/params"
    29  )
    30  
    31  // DefaultConfig contains default settings for use on the GoChain main net.
    32  var DefaultConfig = Config{
    33  	SyncMode:      downloader.FastSync,
    34  	NetworkId:     params.MainnetChainID,
    35  	LightPeers:    100,
    36  	DatabaseCache: 768,
    37  	TrieCache:     256,
    38  	TrieTimeout:   60 * time.Minute,
    39  	MinerGasFloor: params.TargetGasLimit,
    40  	MinerGasCeil:  params.TargetGasLimit,
    41  	MinerGasPrice: gasprice.Default,
    42  	MinerRecommit: 1 * time.Second,
    43  
    44  	TxPool: core.DefaultTxPoolConfig,
    45  	GPO: gasprice.Config{
    46  		Blocks:     5,
    47  		Percentile: 60,
    48  	},
    49  }
    50  
    51  //go:generate gencodec -type Config -field-override configMarshaling -formats toml -out gen_config.go
    52  
    53  type Config struct {
    54  	// The genesis block, which is inserted if the database is empty.
    55  	// If nil, the GoChain main net block is used.
    56  	Genesis *core.Genesis `toml:",omitempty"`
    57  
    58  	// Protocol options
    59  	NetworkId uint64 // Network ID to use for selecting peers to connect to
    60  	SyncMode  downloader.SyncMode
    61  	NoPruning bool
    62  
    63  	// Light client options
    64  	LightServ  int `toml:",omitempty"` // Maximum percentage of time allowed for serving LES requests
    65  	LightPeers int `toml:",omitempty"` // Maximum number of LES client peers
    66  
    67  	// Database options
    68  	SkipBcVersionCheck bool `toml:"-"`
    69  	DatabaseHandles    int  `toml:"-"`
    70  	DatabaseCache      int
    71  	TrieCache          int
    72  	TrieTimeout        time.Duration
    73  
    74  	// Mining-related options
    75  	Etherbase      common.Address `toml:",omitempty"`
    76  	MinerNotify    []string       `toml:",omitempty"`
    77  	MinerExtraData []byte         `toml:",omitempty"`
    78  	MinerGasFloor  uint64
    79  	MinerGasCeil   uint64
    80  	MinerGasPrice  *big.Int
    81  	MinerRecommit  time.Duration
    82  	MinerNoverify  bool
    83  
    84  	// Transaction pool options
    85  	TxPool core.TxPoolConfig
    86  
    87  	// Gas Price Oracle options
    88  	GPO gasprice.Config
    89  
    90  	// Enables tracking of SHA3 preimages in the VM
    91  	EnablePreimageRecording bool
    92  
    93  	// Miscellaneous options
    94  	DocRoot string `toml:"-"`
    95  }
    96  
    97  type configMarshaling struct {
    98  	MinerExtraData hexutil.Bytes
    99  }