Skip to content

Commit

Permalink
darksidewallet: GetLightdInfo with no blocks shouldn't crash
Browse files Browse the repository at this point in the history
Instead, return a reasonable error message. Issue #451.
  • Loading branch information
Larry Ruane authored and LarryRuane committed Sep 4, 2023
1 parent 853016b commit 8003d7f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/darkside.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 8003d7f

Please sign in to comment.