Parse the bitcoin block out of a getrawblockbyheight response. */
| 37 | |
| 38 | /* Parse the bitcoin block out of a getrawblockbyheight response. */ |
| 39 | static struct bitcoin_block *block_from_response(const char *buf, |
| 40 | const jsmntok_t *result, |
| 41 | struct bitcoin_blkid *blockhash_out) |
| 42 | { |
| 43 | const jsmntok_t *blocktok = json_get_member(buf, result, "block"); |
| 44 | struct bitcoin_block *block; |
| 45 | |
| 46 | if (!blocktok) |
| 47 | return NULL; |
| 48 | |
| 49 | block = bitcoin_block_from_hex(tmpctx, chainparams, |
| 50 | buf + blocktok->start, |
| 51 | blocktok->end - blocktok->start); |
| 52 | if (block && blockhash_out) |
| 53 | bitcoin_block_blkid(block, blockhash_out); |
| 54 | |
| 55 | return block; |
| 56 | } |
| 57 | |
| 58 | /* Fetch a block by height for normal polling. */ |
| 59 | static struct command_result *fetch_block_handle(struct command *cmd, |
no test coverage detected