github.com/Gessiux/neatchain@v1.3.1/neatptc/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 neatptc
    18  
    19  import (
    20  	"math/big"
    21  	"os"
    22  	"os/user"
    23  
    24  	//"path/filepath"
    25  	"runtime"
    26  	"time"
    27  
    28  	"github.com/Gessiux/neatchain/chain/consensus/neatcon"
    29  	"github.com/Gessiux/neatchain/chain/core"
    30  	"github.com/Gessiux/neatchain/neatptc/downloader"
    31  	"github.com/Gessiux/neatchain/neatptc/gasprice"
    32  	"github.com/Gessiux/neatchain/params"
    33  	"github.com/Gessiux/neatchain/utilities/common"
    34  	"github.com/Gessiux/neatchain/utilities/common/hexutil"
    35  )
    36  
    37  // DefaultConfig contains default settings for use on the NEATChain main net.
    38  var DefaultConfig = Config{
    39  	//SyncMode: downloader.FastSync,
    40  	SyncMode: downloader.FullSync,
    41  	//NetworkId:      1,
    42  	NetworkId:      9910,
    43  	DatabaseCache:  512,
    44  	TrieCleanCache: 256,
    45  	TrieDirtyCache: 256,
    46  	TrieTimeout:    60 * time.Minute,
    47  	MinerGasFloor:  120000000,
    48  	MinerGasCeil:   120000000,
    49  	MinerGasPrice:  big.NewInt(params.GWei),
    50  
    51  	TxPool: core.DefaultTxPoolConfig,
    52  	GPO: gasprice.Config{
    53  		Blocks:     20,
    54  		Percentile: 60,
    55  	},
    56  }
    57  
    58  func init() {
    59  	home := os.Getenv("HOME")
    60  	if home == "" {
    61  		if user, err := user.Current(); err == nil {
    62  			home = user.HomeDir
    63  		}
    64  	}
    65  	if runtime.GOOS == "windows" {
    66  		//DefaultConfig.DatasetDir = filepath.Join(home, "AppData", "Ethash")
    67  	} else {
    68  		//DefaultConfig.Ethash.DatasetDir = filepath.Join(home, ".ethash")
    69  	}
    70  }
    71  
    72  //go:generate gencodec -type Config -field-override configMarshaling -formats toml -out gen_config.go
    73  
    74  type Config struct {
    75  	// The genesis block, which is inserted if the database is empty.
    76  	// If nil, the Ethereum main net block is used.
    77  	Genesis *core.Genesis `toml:",omitempty"`
    78  
    79  	// Protocol options
    80  	NetworkId uint64 // Network ID to use for selecting peers to connect to
    81  	SyncMode  downloader.SyncMode
    82  
    83  	NoPruning bool // Whether to disable pruning and flush everything to disk
    84  
    85  	// Database options
    86  	SkipBcVersionCheck bool `toml:"-"`
    87  	DatabaseHandles    int  `toml:"-"`
    88  	DatabaseCache      int
    89  
    90  	TrieCleanCache int
    91  	TrieDirtyCache int
    92  	TrieTimeout    time.Duration
    93  
    94  	// Mining-related options
    95  	Coinbase      common.Address `toml:",omitempty"`
    96  	ExtraData     []byte         `toml:",omitempty"`
    97  	MinerGasFloor uint64
    98  	MinerGasCeil  uint64
    99  	MinerGasPrice *big.Int
   100  
   101  	// Solidity compiler path
   102  	SolcPath string
   103  
   104  	// Transaction pool options
   105  	TxPool core.TxPoolConfig
   106  
   107  	// Gas Price Oracle options
   108  	GPO gasprice.Config
   109  
   110  	// Enables tracking of SHA3 preimages in the VM
   111  	EnablePreimageRecording bool
   112  
   113  	// NeatCon options
   114  	NeatCon neatcon.Config
   115  
   116  	// Miscellaneous options
   117  	DocRoot string `toml:"-"`
   118  
   119  	// Data Reduction options
   120  	PruneStateData bool
   121  	PruneBlockData bool
   122  }
   123  
   124  type configMarshaling struct {
   125  	ExtraData hexutil.Bytes
   126  }