darksidewallet: GetLightdInfo with no blocks shouldn't crash
Instead, return a reasonable error message. Issue #451.
This commit is contained in:
parent
853016bfd2
commit
8003d7fb6e
|
@ -480,7 +480,8 @@ func darksideRawRequest(method string, params []json.RawMessage) (json.RawMessag
|
||||||
switch method {
|
switch method {
|
||||||
case "getblockchaininfo":
|
case "getblockchaininfo":
|
||||||
if len(state.activeBlocks) == 0 {
|
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
|
index := state.latestHeight - state.startHeight
|
||||||
block := parser.NewBlock()
|
block := parser.NewBlock()
|
||||||
|
|
Loading…
Reference in New Issue