From 8003d7fb6e3c47fb0561121a0ee47d080c8c46b9 Mon Sep 17 00:00:00 2001 From: Larry Ruane Date: Mon, 4 Sep 2023 14:51:05 -0600 Subject: [PATCH] darksidewallet: GetLightdInfo with no blocks shouldn't crash Instead, return a reasonable error message. Issue #451. --- common/darkside.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/darkside.go b/common/darkside.go index 5a022ae..1e6e957 100644 --- a/common/darkside.go +++ b/common/darkside.go @@ -480,7 +480,8 @@ func darksideRawRequest(method string, params []json.RawMessage) (json.RawMessag switch method { case "getblockchaininfo": if len(state.activeBlocks) == 0 { - Log.Fatal("getblockchaininfo: no blocks") + return nil, errors.New("GetLightdInfo requires at least one block, " + + "please stage and apply one or more blocks.") } index := state.latestHeight - state.startHeight block := parser.NewBlock()