diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-11-18 17:28:44 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-11-18 17:37:58 +0100 |
commit | 73fa5e604356ab4182971376fd758b4680737b5a (patch) | |
tree | 0a26db42198a0249c729e65a412304e7f996cab4 /src/coins.cpp | |
parent | 03403d8c0f3b40f04ef9fac8781ac8e19ed304ec (diff) | |
parent | 1cf3dd80a614fddbafac387e446fd83d118e0c25 (diff) |
Merge pull request #6932
1cf3dd8 Add unit test for UpdateCoins (Alex Morcos)
03c8282 Make CCoinsViewTest behave like CCoinsViewDB (Alex Morcos)
14470f9 ModifyNewCoins saves database lookups (Alex Morcos)
Diffstat (limited to 'src/coins.cpp')
-rw-r--r-- | src/coins.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/coins.cpp b/src/coins.cpp index f02949de53..96b336ce77 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -117,6 +117,15 @@ CCoinsModifier CCoinsViewCache::ModifyCoins(const uint256 &txid) { return CCoinsModifier(*this, ret.first, cachedCoinUsage); } +CCoinsModifier CCoinsViewCache::ModifyNewCoins(const uint256 &txid) { + assert(!hasModifier); + std::pair<CCoinsMap::iterator, bool> ret = cacheCoins.insert(std::make_pair(txid, CCoinsCacheEntry())); + ret.first->second.coins.Clear(); + ret.first->second.flags = CCoinsCacheEntry::FRESH; + ret.first->second.flags |= CCoinsCacheEntry::DIRTY; + return CCoinsModifier(*this, ret.first, 0); +} + const CCoins* CCoinsViewCache::AccessCoins(const uint256 &txid) const { CCoinsMap::const_iterator it = FetchCoins(txid); if (it == cacheCoins.end()) { |