Skip to content

Commit

Permalink
Merge pull request #492 from zcoinofficial/fix_reading_error
Browse files Browse the repository at this point in the history
Skipped reading on garbage records
  • Loading branch information
riordant authored Jul 5, 2019
2 parents 27a1eec + d903a30 commit a33f266
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/wallet/walletdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1414,26 +1414,31 @@ std::vector<std::pair<uint256, MintPoolEntry>> CWalletDB::ListMintPool()
}

// Unserialize
string strType;
ssKey >> strType;
if (strType != "mintpool")
break;

uint256 hashPubcoin;
ssKey >> hashPubcoin;
try {
string strType;
ssKey >> strType;
if (strType != "mintpool")
break;

uint160 hashSeedMaster;
ssValue >> hashSeedMaster;
uint256 hashPubcoin;
ssKey >> hashPubcoin;

CKeyID seedId;
ssValue >> seedId;
uint160 hashSeedMaster;
ssValue >> hashSeedMaster;

int32_t nCount;
ssValue >> nCount;
CKeyID seedId;
ssValue >> seedId;

MintPoolEntry mintPoolEntry(hashSeedMaster, seedId, nCount);
int32_t nCount;
ssValue >> nCount;

listPool.push_back(make_pair(hashPubcoin, mintPoolEntry));
MintPoolEntry mintPoolEntry(hashSeedMaster, seedId, nCount);

listPool.push_back(make_pair(hashPubcoin, mintPoolEntry));
} catch (std::ios_base::failure const &) {
// There maybe some old entries that don't conform to the latest version. Just skipping those.
}
}

pcursor->close();
Expand Down

0 comments on commit a33f266

Please sign in to comment.