mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-04 06:12:07 +01:00
Prevent crashes due to missing or corrupted blk????.dat records
In LoadExternalBlockFile(), errors are already caught... silently. Add a warning message, even though we do not abort the program due to load error.
This commit is contained in:
committed by
Gavin Andresen
parent
4bd6299efd
commit
57ca021e7e
15
src/main.h
15
src/main.h
@@ -594,7 +594,13 @@ public:
|
||||
// Read transaction
|
||||
if (fseek(filein, pos.nTxPos, SEEK_SET) != 0)
|
||||
return error("CTransaction::ReadFromDisk() : fseek failed");
|
||||
filein >> *this;
|
||||
|
||||
try {
|
||||
filein >> *this;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
return error("%s() : deserialize or I/O error", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
// Return file pointer
|
||||
if (pfileRet)
|
||||
@@ -976,7 +982,12 @@ public:
|
||||
filein.nType |= SER_BLOCKHEADERONLY;
|
||||
|
||||
// Read block
|
||||
filein >> *this;
|
||||
try {
|
||||
filein >> *this;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
return error("%s() : deserialize or I/O error", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
// Check the header
|
||||
if (!CheckProofOfWork(GetHash(), nBits))
|
||||
|
||||
Reference in New Issue
Block a user