mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-13 02:58:21 +01:00
bcli: allow non 0 exit status for getblock call
This allows us to intercept getblock on a non 0 exit when the block was not found. We fill this with something meaningull in future commits. Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This commit is contained in:
parent
448f4c0cfb
commit
e06c3245f5
1 changed files with 13 additions and 2 deletions
|
@ -562,7 +562,7 @@ struct getrawblock_stash {
|
||||||
const char *block_hex;
|
const char *block_hex;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct command_result *process_getrawblock(struct bitcoin_cli *bcli)
|
static struct command_result *process_rawblock(struct bitcoin_cli *bcli)
|
||||||
{
|
{
|
||||||
struct json_stream *response;
|
struct json_stream *response;
|
||||||
struct getrawblock_stash *stash = bcli->stash;
|
struct getrawblock_stash *stash = bcli->stash;
|
||||||
|
@ -577,6 +577,17 @@ static struct command_result *process_getrawblock(struct bitcoin_cli *bcli)
|
||||||
return command_finished(bcli->cmd, response);
|
return command_finished(bcli->cmd, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct command_result *process_getrawblock(struct bitcoin_cli *bcli)
|
||||||
|
{
|
||||||
|
/* We failed to get the raw block. */
|
||||||
|
if (bcli->exitstatus && *bcli->exitstatus != 0) {
|
||||||
|
/* retry */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return process_rawblock(bcli);
|
||||||
|
}
|
||||||
|
|
||||||
static struct command_result *
|
static struct command_result *
|
||||||
getrawblockbyheight_notfound(struct bitcoin_cli *bcli)
|
getrawblockbyheight_notfound(struct bitcoin_cli *bcli)
|
||||||
{
|
{
|
||||||
|
@ -607,7 +618,7 @@ static struct command_result *process_getblockhash(struct bitcoin_cli *bcli)
|
||||||
return command_err_bcli_badjson(bcli, "bad blockhash");
|
return command_err_bcli_badjson(bcli, "bad blockhash");
|
||||||
}
|
}
|
||||||
|
|
||||||
start_bitcoin_cli(NULL, bcli->cmd, process_getrawblock, false,
|
start_bitcoin_cli(NULL, bcli->cmd, process_getrawblock, true,
|
||||||
BITCOIND_HIGH_PRIO, stash,
|
BITCOIND_HIGH_PRIO, stash,
|
||||||
"getblock",
|
"getblock",
|
||||||
stash->block_hash,
|
stash->block_hash,
|
||||||
|
|
Loading…
Add table
Reference in a new issue