aboutsummaryrefslogtreecommitdiff
path: root/src/coins.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-08-24 02:08:05 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2014-08-24 02:08:33 +0200
commitb0875eb3fea0934f3a6651fbc22aac12e33e15e5 (patch)
tree24d1ee392c0b29a61e0b4c09bae780d6ae35866d /src/coins.h
parent5cd00bc8cb6820d3b41bea329fcf0c26c03db64a (diff)
Allow BatchWrite to destroy its input, reducing copying
Diffstat (limited to 'src/coins.h')
-rw-r--r--src/coins.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/coins.h b/src/coins.h
index ff60288163..2b657299e3 100644
--- a/src/coins.h
+++ b/src/coins.h
@@ -291,8 +291,9 @@ public:
// Modify the currently active block hash
virtual bool SetBestBlock(const uint256 &hashBlock);
- // Do a bulk modification (multiple SetCoins + one SetBestBlock)
- virtual bool BatchWrite(const CCoinsMap &mapCoins, const uint256 &hashBlock);
+ // Do a bulk modification (multiple SetCoins + one SetBestBlock).
+ // The passed mapCoins can be modified.
+ virtual bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock);
// Calculate statistics about the unspent transaction output set
virtual bool GetStats(CCoinsStats &stats);
@@ -316,7 +317,7 @@ public:
uint256 GetBestBlock();
bool SetBestBlock(const uint256 &hashBlock);
void SetBackend(CCoinsView &viewIn);
- bool BatchWrite(const CCoinsMap &mapCoins, const uint256 &hashBlock);
+ bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock);
bool GetStats(CCoinsStats &stats);
};
@@ -337,7 +338,7 @@ public:
bool HaveCoins(const uint256 &txid);
uint256 GetBestBlock();
bool SetBestBlock(const uint256 &hashBlock);
- bool BatchWrite(const CCoinsMap &mapCoins, const uint256 &hashBlock);
+ bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock);
// Return a modifiable reference to a CCoins. Check HaveCoins first.
// Many methods explicitly require a CCoinsViewCache because of this method, to reduce
@@ -346,6 +347,7 @@ public:
// Push the modifications applied to this cache to its base.
// Failure to call this method before destruction will cause the changes to be forgotten.
+ // If false is returned, the state of this cache (and its backing view) will be undefined.
bool Flush();
// Calculate the size of the cache (in number of transactions)