mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +01:00
blockstorage: allow reading partial block data from storage
It will allow fetching specific transactions using an external index, following https://github.com/bitcoin/bitcoin/pull/32541#issuecomment-3267485313. No logging takes place in case of an invalid offset/size (to avoid spamming the log), by using a new `ReadRawError::BadPartRange` error variant. Co-authored-by: Hodlinator <172445034+hodlinator@users.noreply.github.com> Co-authored-by: Lőrinc <pap.lorinc@gmail.com>
This commit is contained in:
@@ -420,6 +420,7 @@ static bool rest_block(const std::any& context,
|
||||
if (!block_data) {
|
||||
switch (block_data.error()) {
|
||||
case node::ReadRawError::IO: return RESTERR(req, HTTP_INTERNAL_SERVER_ERROR, "I/O error reading " + hashStr);
|
||||
case node::ReadRawError::BadPartRange: break; // can happen only when reading a block part
|
||||
}
|
||||
assert(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user