40 return error(
"ReadBlockFromDisk: OpenBlockFile failed for %s",
47 }
catch (
const std::exception &e) {
48 return error(
"%s: Deserialize or I/O error - %s at %s", __func__,
54 return error(
"ReadBlockFromDisk: Errors in block header at %s",
74 return error(
"ReadBlockFromDisk(CBlock&, CBlockIndex*): GetHash() " 75 "doesn't match index for %s at %s",
std::string ToString() const
bool ReadBlockFromDisk(CBlock &block, const FlatFilePos &pos, const Consensus::Params ¶ms)
Functions for disk access for blocks.
FlatFileSeq BlockFileSeq()
static constexpr unsigned int BLOCKFILE_CHUNK_SIZE
The pre-allocation chunk size for blk?????.dat files (since 0.8)
fs::path GetBlockPosFilename(const FlatFilePos &pos)
Translation to a filesystem path.
FlatFilePos GetBlockPos() const
const fs::path & GetBlocksDir()
bool IsNull() const
Return true if the wrapped FILE* is nullptr, false otherwise.
FILE * Open(const FlatFilePos &pos, bool read_only=false)
Open a handle to the file at the given position.
BlockHash GetBlockHash() const
FlatFileSeq UndoFileSeq()
FILE * OpenBlockFile(const FlatFilePos &pos, bool fReadOnly)
Open a block file (blk?????.dat).
RecursiveMutex cs_main
Global state.
Parameters that influence chain consensus.
FILE * OpenUndoFile(const FlatFilePos &pos, bool fReadOnly)
Open an undo file (rev?????.dat)
bool CheckProofOfWork(const BlockHash &hash, uint32_t nBits, const Consensus::Params ¶ms)
Check whether a block hash satisfies the proof-of-work requirement specified by nBits.
std::string ToString() const
fs::path FileName(const FlatFilePos &pos) const
Get the name of the file at the given position.
static constexpr int CLIENT_VERSION
bitcoind-res.rc includes this file, but it cannot cope with real c++ code.
The block chain is a tree shaped structure starting with the genesis block at the root...
static const unsigned int UNDOFILE_CHUNK_SIZE
The pre-allocation chunk size for rev?????.dat files (since 0.8)
FlatFileSeq represents a sequence of numbered files storing raw data.
bool error(const char *fmt, const Args &... args)
Non-refcounted RAII wrapper for FILE*.