Instead of always returning witness signatures (as in #2641), this PR adds an optional with_witness_signature parameter to the get_block_header API, and add an optional with_witness_signatures parameter to the get_block_header_batch API, to indicate whether to return witness signatures.
This PR also updates the return types of these 2 APIs so that witness signature can optionally be returned. The new type maybe_signed_block_header is derived from block_header with an optional witness_signature field.
/**
* @brief Retrieve a block header
* @param block_num Height of the block whose header should be returned
* @param with_witness_signature Whether to return witness signature. Optional.
* If omitted or is @a false, will not return witness signature.
* @return header of the referenced block, or null if no matching block was found
*/
optional<maybe_signed_block_header> get_block_header(
uint32_t block_num,
const optional<bool>& with_witness_signature = optional<bool>() )const;
/**
* @brief Retrieve multiple block headers by block numbers
* @param block_nums vector containing heights of the blocks whose headers should be returned
* @param with_witness_signatures Whether to return witness signatures. Optional.
* If omitted or is @a false, will not return witness signatures.
* @return array of headers of the referenced blocks, or null if no matching block was found
*/
map<uint32_t, optional<maybe_signed_block_header>> get_block_header_batch(
const vector<uint32_t>& block_nums,
const optional<bool>& with_witness_signatures = optional<bool>() )const;
Follow-up of #2641, for issue #2588.
Instead of always returning witness signatures (as in #2641), this PR adds an optional
with_witness_signature
parameter to theget_block_header
API, and add an optionalwith_witness_signatures
parameter to theget_block_header_batch
API, to indicate whether to return witness signatures.This PR also updates the return types of these 2 APIs so that witness signature can optionally be returned. The new type
maybe_signed_block_header
is derived fromblock_header
with an optionalwitness_signature
field.Updated APIs:
get_block_header( block_num, with_witness_signature )
get_block_header_batch( block_nums, with_witness_signatures )