bcli: return "not found" on any getblockhash exit status
Return "not found" on any `getblockhash` exit status. Previously, only exit code 8 (block height doesn't exist) returned "not found", while other exit codes returned an error. Now any non-zero exit status returns "not found" since any failure means the block is unavailable.
This commit is contained in:
@@ -344,10 +344,7 @@ static struct command_result *getrawblockbyheight(struct command *cmd,
|
||||
tal_fmt(tmpctx, "%u", *height), NULL);
|
||||
|
||||
if (res->exitstatus != 0) {
|
||||
/* Exit code 8 means block height doesn't exist (empty response) */
|
||||
if (res->exitstatus == 8)
|
||||
return getrawblockbyheight_notfound(cmd);
|
||||
return command_err(cmd, res, "command failed");
|
||||
return getrawblockbyheight_notfound(cmd);
|
||||
}
|
||||
|
||||
strip_trailing_whitespace(res->output, res->output_len);
|
||||
|
||||
Reference in New Issue
Block a user