|
|
@ -26,8 +26,8 @@ void static BatchWriteHashBestChain(CLevelDBBatch &batch, const uint256 &hash) { |
|
|
|
CCoinsViewDB::CCoinsViewDB(size_t nCacheSize, bool fMemory, bool fWipe) : db(GetDataDir() / "chainstate", nCacheSize, fMemory, fWipe) { |
|
|
|
CCoinsViewDB::CCoinsViewDB(size_t nCacheSize, bool fMemory, bool fWipe) : db(GetDataDir() / "chainstate", nCacheSize, fMemory, fWipe) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool CCoinsViewDB::GetCoins(const uint256 &txid, CCoins &coins) { |
|
|
|
bool CCoinsViewDB::GetCoins(const uint256 &txid, CCoins &coins) { |
|
|
|
return db.Read(make_pair('c', txid), coins); |
|
|
|
return db.Read(make_pair('c', txid), coins); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool CCoinsViewDB::SetCoins(const uint256 &txid, const CCoins &coins) { |
|
|
|
bool CCoinsViewDB::SetCoins(const uint256 &txid, const CCoins &coins) { |
|
|
@ -37,7 +37,7 @@ bool CCoinsViewDB::SetCoins(const uint256 &txid, const CCoins &coins) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool CCoinsViewDB::HaveCoins(const uint256 &txid) { |
|
|
|
bool CCoinsViewDB::HaveCoins(const uint256 &txid) { |
|
|
|
return db.Exists(make_pair('c', txid)); |
|
|
|
return db.Exists(make_pair('c', txid)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
uint256 CCoinsViewDB::GetBestBlock() { |
|
|
|
uint256 CCoinsViewDB::GetBestBlock() { |
|
|
@ -131,7 +131,7 @@ bool CCoinsViewDB::GetStats(CCoinsStats &stats) { |
|
|
|
ssKey >> txhash; |
|
|
|
ssKey >> txhash; |
|
|
|
ss << txhash; |
|
|
|
ss << txhash; |
|
|
|
ss << VARINT(coins.nVersion); |
|
|
|
ss << VARINT(coins.nVersion); |
|
|
|
ss << (coins.fCoinBase ? 'c' : 'n'); |
|
|
|
ss << (coins.fCoinBase ? 'c' : 'n'); |
|
|
|
ss << VARINT(coins.nHeight); |
|
|
|
ss << VARINT(coins.nHeight); |
|
|
|
stats.nTransactions++; |
|
|
|
stats.nTransactions++; |
|
|
|
for (unsigned int i=0; i<coins.vout.size(); i++) { |
|
|
|
for (unsigned int i=0; i<coins.vout.size(); i++) { |
|
|
@ -148,7 +148,7 @@ bool CCoinsViewDB::GetStats(CCoinsStats &stats) { |
|
|
|
} |
|
|
|
} |
|
|
|
pcursor->Next(); |
|
|
|
pcursor->Next(); |
|
|
|
} catch (std::exception &e) { |
|
|
|
} catch (std::exception &e) { |
|
|
|
return error("%s() : deserialize error", __PRETTY_FUNCTION__); |
|
|
|
return error("%s : Deserialize or I/O error - %s", __PRETTY_FUNCTION__, e.what()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
delete pcursor; |
|
|
|
delete pcursor; |
|
|
@ -226,7 +226,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts() |
|
|
|
break; // if shutdown requested or finished loading block index
|
|
|
|
break; // if shutdown requested or finished loading block index
|
|
|
|
} |
|
|
|
} |
|
|
|
} catch (std::exception &e) { |
|
|
|
} catch (std::exception &e) { |
|
|
|
return error("%s() : deserialize error", __PRETTY_FUNCTION__); |
|
|
|
return error("%s : Deserialize or I/O error - %s", __PRETTY_FUNCTION__, e.what()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
delete pcursor; |
|
|
|
delete pcursor; |
|
|
|