Merge pull request #601 from rnicoll/1.8-dev-leveldb
Fix assertion error loading 1.7 blocks in 1.8 client
This commit is contained in:
commit
769fbade61
|
@ -198,7 +198,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts()
|
|||
|
||||
CDataStream ssKeySet(SER_DISK, CLIENT_VERSION);
|
||||
uint256 hash;
|
||||
ssKeySet << boost::tuples::make_tuple('b', uint256(0), 'a'); // 'b' is the prefix for BlockIndex, 'a' sigifies the first part
|
||||
ssKeySet << boost::tuples::make_tuple('b', uint256(0), 'a'); // 'b' is the prefix for BlockIndex, 'a' signifies the first part
|
||||
pcursor->Seek(ssKeySet.str());
|
||||
|
||||
// Load mapBlockIndex
|
||||
|
@ -210,6 +210,11 @@ bool CBlockTreeDB::LoadBlockIndexGuts()
|
|||
char chType;
|
||||
ssKey >> chType;
|
||||
if (chType == 'b') {
|
||||
// Detect pre-1.8 keys in the database and abort if found
|
||||
if (slKey.size() < ssKeySet.size()) {
|
||||
return error("Database key size is %d expected %d, require reindex to upgrade.", slKey.size(), ssKeySet.size());
|
||||
}
|
||||
|
||||
ssKey >> hash;
|
||||
|
||||
leveldb::Slice slValue = pcursor->value();
|
||||
|
|
Loading…
Reference in a new issue