diff --git a/core/txpool/legacypool/gen_config.go b/core/txpool/legacypool/gen_config.go new file mode 100644 index 0000000000..a971b0ece3 --- /dev/null +++ b/core/txpool/legacypool/gen_config.go @@ -0,0 +1,106 @@ +// Code generated by github.com/fjl/gencodec. DO NOT EDIT. + +package legacypool + +import ( + "time" + + "github.com/ethereum/go-ethereum/common" +) + +// MarshalTOML marshals as TOML. +func (c Config) MarshalTOML() (interface{}, error) { + type Config struct { + Locals []common.Address + NoLocals bool + Journal string + Rejournal time.Duration + PriceLimit uint64 + PriceBump uint64 + AccountSlots uint64 + GlobalSlots uint64 + AccountQueue uint64 + GlobalQueue uint64 + OverflowPoolSlots uint64 + Lifetime time.Duration + ReannounceTime time.Duration + } + var enc Config + enc.Locals = c.Locals + enc.NoLocals = c.NoLocals + enc.Journal = c.Journal + enc.Rejournal = c.Rejournal + enc.PriceLimit = c.PriceLimit + enc.PriceBump = c.PriceBump + enc.AccountSlots = c.AccountSlots + enc.GlobalSlots = c.GlobalSlots + enc.AccountQueue = c.AccountQueue + enc.GlobalQueue = c.GlobalQueue + enc.OverflowPoolSlots = c.OverflowPoolSlots + enc.Lifetime = c.Lifetime + enc.ReannounceTime = c.ReannounceTime + return &enc, nil +} + +// UnmarshalTOML unmarshals from TOML. +func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { + type Config struct { + Locals []common.Address + NoLocals *bool + Journal *string + Rejournal *time.Duration + PriceLimit *uint64 + PriceBump *uint64 + AccountSlots *uint64 + GlobalSlots *uint64 + AccountQueue *uint64 + GlobalQueue *uint64 + OverflowPoolSlots *uint64 + Lifetime *time.Duration + ReannounceTime *time.Duration + } + var dec Config + if err := unmarshal(&dec); err != nil { + return err + } + if dec.Locals != nil { + c.Locals = dec.Locals + } + if dec.NoLocals != nil { + c.NoLocals = *dec.NoLocals + } + if dec.Journal != nil { + c.Journal = *dec.Journal + } + if dec.Rejournal != nil { + c.Rejournal = *dec.Rejournal + } + if dec.PriceLimit != nil { + c.PriceLimit = *dec.PriceLimit + } + if dec.PriceBump != nil { + c.PriceBump = *dec.PriceBump + } + if dec.AccountSlots != nil { + c.AccountSlots = *dec.AccountSlots + } + if dec.GlobalSlots != nil { + c.GlobalSlots = *dec.GlobalSlots + } + if dec.AccountQueue != nil { + c.AccountQueue = *dec.AccountQueue + } + if dec.GlobalQueue != nil { + c.GlobalQueue = *dec.GlobalQueue + } + if dec.OverflowPoolSlots != nil { + c.OverflowPoolSlots = *dec.OverflowPoolSlots + } + if dec.Lifetime != nil { + c.Lifetime = *dec.Lifetime + } + if dec.ReannounceTime != nil { + c.ReannounceTime = *dec.ReannounceTime + } + return nil +} diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 56b3fc7329..9fa1f4a264 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -141,6 +141,8 @@ type BlockChain interface { } // Config are the configuration parameters of the transaction pool. +// +//go:generate go run github.com/fjl/gencodec -type Config -formats toml -out gen_config.go type Config struct { Locals []common.Address // Addresses that should be treated by default as local NoLocals bool // Whether local transaction handling should be disabled @@ -161,11 +163,13 @@ type Config struct { } // DefaultConfig contains the default configurations for the transaction pool. +// +//go:generate go run github.com/fjl/gencodec -type Config -formats toml -out gen_config.go var DefaultConfig = Config{ Journal: "transactions.rlp", Rejournal: time.Hour, - PriceLimit: 1, + PriceLimit: 1000000000, // by default 1 gwei PriceBump: 10, AccountSlots: 16, diff --git a/eth/gasprice/gasprice.go b/eth/gasprice/gasprice.go index e43501b19b..a447ab9b23 100644 --- a/eth/gasprice/gasprice.go +++ b/eth/gasprice/gasprice.go @@ -40,6 +40,7 @@ var ( DefaultIgnorePrice = big.NewInt(4 * params.Wei) ) +//go:generate go run github.com/fjl/gencodec -type Config -formats toml -out gen_config.go type Config struct { Blocks int Percentile int diff --git a/eth/gasprice/gen_config.go b/eth/gasprice/gen_config.go new file mode 100644 index 0000000000..fe4dcb559b --- /dev/null +++ b/eth/gasprice/gen_config.go @@ -0,0 +1,68 @@ +// Code generated by github.com/fjl/gencodec. DO NOT EDIT. + +package gasprice + +import ( + "math/big" +) + +// MarshalTOML marshals as TOML. +func (c Config) MarshalTOML() (interface{}, error) { + type Config struct { + Blocks int + Percentile int + MaxHeaderHistory uint64 + MaxBlockHistory uint64 + MaxPrice *big.Int `toml:",omitempty"` + IgnorePrice *big.Int `toml:",omitempty"` + OracleThreshold int `toml:",omitempty"` + } + var enc Config + enc.Blocks = c.Blocks + enc.Percentile = c.Percentile + enc.MaxHeaderHistory = c.MaxHeaderHistory + enc.MaxBlockHistory = c.MaxBlockHistory + enc.MaxPrice = c.MaxPrice + enc.IgnorePrice = c.IgnorePrice + enc.OracleThreshold = c.OracleThreshold + return &enc, nil +} + +// UnmarshalTOML unmarshals from TOML. +func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { + type Config struct { + Blocks *int + Percentile *int + MaxHeaderHistory *uint64 + MaxBlockHistory *uint64 + MaxPrice *big.Int `toml:",omitempty"` + IgnorePrice *big.Int `toml:",omitempty"` + OracleThreshold *int `toml:",omitempty"` + } + var dec Config + if err := unmarshal(&dec); err != nil { + return err + } + if dec.Blocks != nil { + c.Blocks = *dec.Blocks + } + if dec.Percentile != nil { + c.Percentile = *dec.Percentile + } + if dec.MaxHeaderHistory != nil { + c.MaxHeaderHistory = *dec.MaxHeaderHistory + } + if dec.MaxBlockHistory != nil { + c.MaxBlockHistory = *dec.MaxBlockHistory + } + if dec.MaxPrice != nil { + c.MaxPrice = dec.MaxPrice + } + if dec.IgnorePrice != nil { + c.IgnorePrice = dec.IgnorePrice + } + if dec.OracleThreshold != nil { + c.OracleThreshold = *dec.OracleThreshold + } + return nil +}