erigon-pulse/eth/ethconfig/gen_config.go
Alex Sharov c3e1cfdac8
Pruning for: exec, log_index, tx_lookup, history stages (#2399)
* Pruning for: exec, log_index, tx_lookup, history stages

* Pruning for: exec, log_index, tx_lookup, history stages

* Pruning for: exec, log_index, tx_lookup, history stages

* Pruning for: exec, log_index, tx_lookup, history stages

* add tvm flag

* save

* db migration for storage mode
add flag --prune=
remove flag --storage-mode=
add flag --experiments=tevm,...
rename integration set_storage_mode to set_prune

* fix

* forward move of stages must skip everything before PruneTo

* keep in db progress of prune method

* keep in db progress of prune method

* simplify logs

* simplify logs

* simplify logs

* fix test

* simplify logs

* simplify logs

* simplify logs

* simplify logs

* remove callTraceSet as dupsort
use etl transform for txlookup prune
remove some logs

* cleanup tests a bit

* print_stages and eth_sync to show prune progress

* fix print_stages

* add readme about --prune.to flag

* more docs

* add --prune.history.older and other flags support

* fix migration on empty db

* better toString

* better toString
2021-07-20 21:03:19 +01:00

112 lines
2.9 KiB
Go

// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package ethconfig
import (
"github.com/ledgerwatch/erigon/common"
"github.com/ledgerwatch/erigon/consensus/ethash"
"github.com/ledgerwatch/erigon/core"
"github.com/ledgerwatch/erigon/eth/gasprice"
"github.com/ledgerwatch/erigon/ethdb/prune"
"github.com/ledgerwatch/erigon/params"
)
// MarshalTOML marshals as TOML.
func (c Config) MarshalTOML() (interface{}, error) {
type Config struct {
Genesis *core.Genesis `toml:",omitempty"`
NetworkID uint64
EthDiscoveryURLs []string
Whitelist map[uint64]common.Hash `toml:"-"`
StorageMode string
OnlyAnnounce bool
Miner params.MiningConfig
Ethash ethash.Config
TxPool core.TxPoolConfig
GPO gasprice.Config
RPCGasCap uint64 `toml:",omitempty"`
RPCTxFeeCap float64 `toml:",omitempty"`
}
var enc Config
enc.Genesis = c.Genesis
enc.NetworkID = c.NetworkID
enc.EthDiscoveryURLs = c.EthDiscoveryURLs
enc.Whitelist = c.Whitelist
enc.StorageMode = c.Prune.ToString()
enc.Miner = c.Miner
enc.Ethash = c.Ethash
enc.TxPool = c.TxPool
enc.GPO = c.GPO
enc.RPCGasCap = c.RPCGasCap
enc.RPCTxFeeCap = c.RPCTxFeeCap
return &enc, nil
}
// UnmarshalTOML unmarshals from TOML.
func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
type Config struct {
Genesis *core.Genesis `toml:",omitempty"`
NetworkID *uint64
EthDiscoveryURLs []string
Whitelist map[uint64]common.Hash `toml:"-"`
Mode *string
PruneH *uint64
PruneR *uint64
PruneT *uint64
PruneC *uint64
Experiments *[]string
OnlyAnnounce *bool
SkipBcVersionCheck *bool `toml:"-"`
DatabaseHandles *int `toml:"-"`
DatabaseFreezer *string
Miner *params.MiningConfig
Ethash *ethash.Config
TxPool *core.TxPoolConfig
GPO *gasprice.Config
RPCGasCap *uint64 `toml:",omitempty"`
RPCTxFeeCap *float64 `toml:",omitempty"`
}
var dec Config
if err := unmarshal(&dec); err != nil {
return err
}
if dec.Genesis != nil {
c.Genesis = dec.Genesis
}
if dec.NetworkID != nil {
c.NetworkID = *dec.NetworkID
}
if dec.EthDiscoveryURLs != nil {
c.EthDiscoveryURLs = dec.EthDiscoveryURLs
}
if dec.Whitelist != nil {
c.Whitelist = dec.Whitelist
}
if dec.Mode != nil {
mode, err := prune.FromCli(*dec.Mode, *dec.PruneH, *dec.PruneR, *dec.PruneT, *dec.PruneC, *dec.Experiments)
if err != nil {
return err
}
c.Prune = mode
}
if dec.Miner != nil {
c.Miner = *dec.Miner
}
if dec.Ethash != nil {
c.Ethash = *dec.Ethash
}
if dec.TxPool != nil {
c.TxPool = *dec.TxPool
}
if dec.GPO != nil {
c.GPO = *dec.GPO
}
if dec.RPCGasCap != nil {
c.RPCGasCap = *dec.RPCGasCap
}
if dec.RPCTxFeeCap != nil {
c.RPCTxFeeCap = *dec.RPCTxFeeCap
}
return nil
}