darksidewallet: GetLightdInfo with no blocks shouldn't crash

Instead, return a reasonable error message. Issue #451.
This commit is contained in:
Larry Ruane 2023-09-04 14:51:05 -06:00 committed by Larry Ruane
parent 853016bfd2
commit 8003d7fb6e
1 changed files with 2 additions and 1 deletions

View File

@ -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()