From 7b25fd0b27446dbdffb33b003a52a3fbbb8f4429 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 24 Apr 2024 14:47:22 +0800 Subject: [PATCH] params: fix consensus config string representations These should at least indicate whether the object is nil. --- params/config.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/params/config.go b/params/config.go index 439e882189..4c445982c0 100644 --- a/params/config.go +++ b/params/config.go @@ -375,6 +375,9 @@ type EthashConfig struct{} // String implements the stringer interface, returning the consensus engine details. func (c *EthashConfig) String() string { + if c == nil { + return "" + } return "ethash" } @@ -386,7 +389,10 @@ type CliqueConfig struct { // String implements the stringer interface, returning the consensus engine details. func (c *CliqueConfig) String() string { - return "clique" + if c == nil { + return "" + } + return fmt.Sprintf("Clique { Period: %d, Epoch: %d }", c.Period, c.Epoch) } // Description returns a human-readable description of ChainConfig.