mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
bcli: move getblock call to a separate function
We move the `geblock` call into a separate function. This allows us to call if from various places in the future. Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This commit is contained in:
parent
e06c3245f5
commit
9baa65a738
1 changed files with 14 additions and 9 deletions
|
@ -600,6 +600,19 @@ getrawblockbyheight_notfound(struct bitcoin_cli *bcli)
|
|||
return command_finished(bcli->cmd, response);
|
||||
}
|
||||
|
||||
static struct command_result *getrawblock(struct bitcoin_cli *bcli)
|
||||
{
|
||||
struct getrawblock_stash *stash = bcli->stash;
|
||||
|
||||
start_bitcoin_cli(NULL, bcli->cmd, process_getrawblock, true,
|
||||
BITCOIND_HIGH_PRIO, stash, "getblock",
|
||||
stash->block_hash,
|
||||
/* Non-verbose: raw block. */
|
||||
"0", NULL);
|
||||
|
||||
return command_still_pending(bcli->cmd);
|
||||
}
|
||||
|
||||
static struct command_result *process_getblockhash(struct bitcoin_cli *bcli)
|
||||
{
|
||||
struct getrawblock_stash *stash = bcli->stash;
|
||||
|
@ -618,15 +631,7 @@ static struct command_result *process_getblockhash(struct bitcoin_cli *bcli)
|
|||
return command_err_bcli_badjson(bcli, "bad blockhash");
|
||||
}
|
||||
|
||||
start_bitcoin_cli(NULL, bcli->cmd, process_getrawblock, true,
|
||||
BITCOIND_HIGH_PRIO, stash,
|
||||
"getblock",
|
||||
stash->block_hash,
|
||||
/* Non-verbose: raw block. */
|
||||
"0",
|
||||
NULL);
|
||||
|
||||
return command_still_pending(bcli->cmd);
|
||||
return getrawblock(bcli);
|
||||
}
|
||||
|
||||
/* Get a raw block given its height.
|
||||
|
|
Loading…
Add table
Reference in a new issue