mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Merge pull request #2221 from sipa/perfo
Various performance tweaks to CCoinsView
This commit is contained in:
commit
cc67f1e2b4
4 changed files with 47 additions and 37 deletions
|
|
@ -22,17 +22,17 @@ void static BatchWriteHashBestChain(CLevelDBBatch &batch, const uint256 &hash) {
|
|||
CCoinsViewDB::CCoinsViewDB(size_t nCacheSize, bool fMemory, bool fWipe) : db(GetDataDir() / "chainstate", nCacheSize, fMemory, fWipe) {
|
||||
}
|
||||
|
||||
bool CCoinsViewDB::GetCoins(uint256 txid, CCoins &coins) {
|
||||
bool CCoinsViewDB::GetCoins(const uint256 &txid, CCoins &coins) {
|
||||
return db.Read(make_pair('c', txid), coins);
|
||||
}
|
||||
|
||||
bool CCoinsViewDB::SetCoins(uint256 txid, const CCoins &coins) {
|
||||
bool CCoinsViewDB::SetCoins(const uint256 &txid, const CCoins &coins) {
|
||||
CLevelDBBatch batch;
|
||||
BatchWriteCoins(batch, txid, coins);
|
||||
return db.WriteBatch(batch);
|
||||
}
|
||||
|
||||
bool CCoinsViewDB::HaveCoins(uint256 txid) {
|
||||
bool CCoinsViewDB::HaveCoins(const uint256 &txid) {
|
||||
return db.Exists(make_pair('c', txid));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue