mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
better prune error message (#2475)
This commit is contained in:
parent
a2b97d59ae
commit
3ed0f5c83d
@ -51,8 +51,13 @@ func runErigon(cliCtx *cli.Context) {
|
||||
chaindb.Close()
|
||||
}
|
||||
|
||||
err := node.New(nodeCfg, ethCfg, logger).Serve()
|
||||
ethNode, err := node.New(nodeCfg, ethCfg, logger)
|
||||
if err != nil {
|
||||
log.Error("error while serving a Erigon node", "err", err)
|
||||
log.Error("Erigon startup", "err", err)
|
||||
return
|
||||
}
|
||||
err = ethNode.Serve()
|
||||
if err != nil {
|
||||
log.Error("error while serving an Erigon node", "err", err)
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ func New(stack *node.Node, config *ethconfig.Config, logger log.Logger) (*Ethere
|
||||
if config.Prune.Initialised {
|
||||
// If storage mode is not explicitly specified, we take whatever is in the database
|
||||
if !reflect.DeepEqual(pm, config.Prune) {
|
||||
return errors.New("prune is " + config.Prune.String() + " original prune is " + pm.String())
|
||||
return errors.New("not allowed change of --prune flag, last time you used: " + pm.String())
|
||||
}
|
||||
} else {
|
||||
config.Prune = pm
|
||||
|
@ -152,33 +152,40 @@ func (m Mode) String() string {
|
||||
if !m.Initialised {
|
||||
return "default"
|
||||
}
|
||||
modeString := ""
|
||||
long := ""
|
||||
short := "--prune="
|
||||
if m.History.Enabled() {
|
||||
modeString += fmt.Sprintf("history=%d,", m.History)
|
||||
} else {
|
||||
modeString += "history=no,"
|
||||
if m.History == params.FullImmutabilityThreshold {
|
||||
short += "h"
|
||||
} else {
|
||||
long += fmt.Sprintf(" --prune.h.older=%d", m.History)
|
||||
}
|
||||
}
|
||||
if m.Receipts.Enabled() {
|
||||
modeString += fmt.Sprintf("receipt=%d,", m.Receipts)
|
||||
} else {
|
||||
modeString += "receipt=no,"
|
||||
if m.Receipts == params.FullImmutabilityThreshold {
|
||||
short += "r"
|
||||
} else {
|
||||
long += fmt.Sprintf(" --prune.r.older=%d", m.Receipts)
|
||||
}
|
||||
}
|
||||
if m.TxIndex.Enabled() {
|
||||
modeString += fmt.Sprintf("txindex=%d,", m.TxIndex)
|
||||
} else {
|
||||
modeString += "txindex=no,"
|
||||
if m.TxIndex == params.FullImmutabilityThreshold {
|
||||
short += "t"
|
||||
} else {
|
||||
long += fmt.Sprintf(" --prune.t.older=%d", m.TxIndex)
|
||||
}
|
||||
}
|
||||
if m.CallTraces.Enabled() {
|
||||
modeString += fmt.Sprintf("calltrace=%d,", m.CallTraces)
|
||||
} else {
|
||||
modeString += "calltrace=no,"
|
||||
if m.CallTraces == params.FullImmutabilityThreshold {
|
||||
short += "c"
|
||||
} else {
|
||||
long += fmt.Sprintf(" --prune.c.older=%d", m.CallTraces)
|
||||
}
|
||||
}
|
||||
if m.Experiments.TEVM {
|
||||
modeString += "experiments.tevm=enabled"
|
||||
} else {
|
||||
modeString += "experiments.tevm=disabled"
|
||||
long += " --experiments.tevm=enabled"
|
||||
}
|
||||
return modeString
|
||||
return short + long
|
||||
}
|
||||
|
||||
func Override(db kv.RwTx, sm Mode) error {
|
||||
|
@ -92,20 +92,19 @@ func New(
|
||||
nodeConfig *node.Config,
|
||||
ethConfig *ethconfig.Config,
|
||||
logger log.Logger,
|
||||
) *ErigonNode {
|
||||
) (*ErigonNode, error) {
|
||||
//prepareBuckets(optionalParams.CustomBuckets)
|
||||
node := makeConfigNode(nodeConfig)
|
||||
ethereum := RegisterEthService(node, ethConfig, logger)
|
||||
return &ErigonNode{stack: node, backend: ethereum}
|
||||
ethereum, err := RegisterEthService(node, ethConfig, logger)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ErigonNode{stack: node, backend: ethereum}, nil
|
||||
}
|
||||
|
||||
// RegisterEthService adds an Ethereum client to the stack.
|
||||
func RegisterEthService(stack *node.Node, cfg *ethconfig.Config, logger log.Logger) *eth.Ethereum {
|
||||
backend, err := eth.New(stack, cfg, logger)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return backend
|
||||
func RegisterEthService(stack *node.Node, cfg *ethconfig.Config, logger log.Logger) (*eth.Ethereum, error) {
|
||||
return eth.New(stack, cfg, logger)
|
||||
}
|
||||
|
||||
func NewNodeConfig() *node.Config {
|
||||
|
Loading…
Reference in New Issue
Block a user