mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
When people ask us for headers we do not have (over REST or RPC), do something reasonable.
This commit is contained in:
parent
4f0da3ce3d
commit
f5c79950a1
4 changed files with 62 additions and 11 deletions
|
|
@ -412,6 +412,17 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex, const Consensus
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ReadBlockHeaderFromDisk(CBlockHeader& header, const CBlockIndex* pindex, const Consensus::Params& consensusParams)
|
||||
{
|
||||
// Not very efficient: read a block and throw away all but the header.
|
||||
CBlock tmp;
|
||||
if (!ReadBlockFromDisk(tmp, pindex, consensusParams)) {
|
||||
return false;
|
||||
}
|
||||
header = tmp.GetBlockHeader();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatFilePos& pos, const CMessageHeader::MessageStartChars& message_start)
|
||||
{
|
||||
FlatFilePos hpos = pos;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue