github.com/neatlab/neatio@v1.7.3-0.20220425043230-d903e92fcc75/neatptc/config.go (about)

     1  package neatptc
     2  
     3  import (
     4  	"math/big"
     5  	"os"
     6  	"os/user"
     7  
     8  	"runtime"
     9  	"time"
    10  
    11  	"github.com/neatlab/neatio/chain/consensus/neatcon"
    12  	"github.com/neatlab/neatio/chain/core"
    13  	"github.com/neatlab/neatio/neatptc/downloader"
    14  	"github.com/neatlab/neatio/neatptc/gasprice"
    15  	"github.com/neatlab/neatio/params"
    16  	"github.com/neatlab/neatio/utilities/common"
    17  	"github.com/neatlab/neatio/utilities/common/hexutil"
    18  )
    19  
    20  var DefaultConfig = Config{
    21  
    22  	SyncMode: downloader.FullSync,
    23  
    24  	NetworkId:      515,
    25  	DatabaseCache:  512,
    26  	TrieCleanCache: 256,
    27  	TrieDirtyCache: 256,
    28  	TrieTimeout:    60 * time.Minute,
    29  	MinerGasFloor:  120000000,
    30  	MinerGasCeil:   120000000,
    31  	MinerGasPrice:  big.NewInt(500 * params.GWei),
    32  
    33  	TxPool: core.DefaultTxPoolConfig,
    34  	GPO: gasprice.Config{
    35  		Blocks:     20,
    36  		Percentile: 60,
    37  	},
    38  }
    39  
    40  func init() {
    41  	home := os.Getenv("HOME")
    42  	if home == "" {
    43  		if user, err := user.Current(); err == nil {
    44  			home = user.HomeDir
    45  		}
    46  	}
    47  	if runtime.GOOS == "windows" {
    48  
    49  	} else {
    50  
    51  	}
    52  }
    53  
    54  type Config struct {
    55  	Genesis *core.Genesis `toml:",omitempty"`
    56  
    57  	NetworkId uint64
    58  	SyncMode  downloader.SyncMode
    59  
    60  	NoPruning bool
    61  
    62  	SkipBcVersionCheck bool `toml:"-"`
    63  	DatabaseHandles    int  `toml:"-"`
    64  	DatabaseCache      int
    65  
    66  	TrieCleanCache int
    67  	TrieDirtyCache int
    68  	TrieTimeout    time.Duration
    69  
    70  	Coinbase      common.Address `toml:",omitempty"`
    71  	ExtraData     []byte         `toml:",omitempty"`
    72  	MinerGasFloor uint64
    73  	MinerGasCeil  uint64
    74  	MinerGasPrice *big.Int
    75  
    76  	SolcPath string
    77  
    78  	TxPool core.TxPoolConfig
    79  
    80  	GPO gasprice.Config
    81  
    82  	EnablePreimageRecording bool
    83  
    84  	NeatCon neatcon.Config
    85  
    86  	DocRoot string `toml:"-"`
    87  
    88  	PruneStateData bool
    89  	PruneBlockData bool
    90  }
    91  
    92  type configMarshaling struct {
    93  	ExtraData hexutil.Bytes
    94  }