mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
better std::exception logging for block/undo files
This commit is contained in:
10
src/main.h
10
src/main.h
@@ -336,7 +336,7 @@ public:
|
||||
// Open history file to append
|
||||
CAutoFile fileout = CAutoFile(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION);
|
||||
if (!fileout)
|
||||
return error("CBlockUndo::WriteToDisk() : OpenUndoFile failed");
|
||||
return error("CBlockUndo::WriteToDisk : OpenUndoFile failed");
|
||||
|
||||
// Write index header
|
||||
unsigned int nSize = fileout.GetSerializeSize(*this);
|
||||
@@ -345,7 +345,7 @@ public:
|
||||
// Write undo data
|
||||
long fileOutPos = ftell(fileout);
|
||||
if (fileOutPos < 0)
|
||||
return error("CBlockUndo::WriteToDisk() : ftell failed");
|
||||
return error("CBlockUndo::WriteToDisk : ftell failed");
|
||||
pos.nPos = (unsigned int)fileOutPos;
|
||||
fileout << *this;
|
||||
|
||||
@@ -368,7 +368,7 @@ public:
|
||||
// Open history file to read
|
||||
CAutoFile filein = CAutoFile(OpenUndoFile(pos, true), SER_DISK, CLIENT_VERSION);
|
||||
if (!filein)
|
||||
return error("CBlockUndo::ReadFromDisk() : OpenBlockFile failed");
|
||||
return error("CBlockUndo::ReadFromDisk : OpenBlockFile failed");
|
||||
|
||||
// Read block
|
||||
uint256 hashChecksum;
|
||||
@@ -377,7 +377,7 @@ public:
|
||||
filein >> hashChecksum;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
return error("%s() : deserialize or I/O error", __PRETTY_FUNCTION__);
|
||||
return error("%s : Deserialize or I/O error - %s", __PRETTY_FUNCTION__, e.what());
|
||||
}
|
||||
|
||||
// Verify checksum
|
||||
@@ -385,7 +385,7 @@ public:
|
||||
hasher << hashBlock;
|
||||
hasher << *this;
|
||||
if (hashChecksum != hasher.GetHash())
|
||||
return error("CBlockUndo::ReadFromDisk() : checksum mismatch");
|
||||
return error("CBlockUndo::ReadFromDisk : Checksum mismatch");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user