Use override keyword on CCoinsView overrides

This commit is contained in:
Russell Yanofsky 2017-06-08 09:28:28 -04:00
parent 24e44c354d
commit 3ff1fa8c4a
2 changed files with 9 additions and 9 deletions

View file

@ -207,12 +207,12 @@ public:
CCoinsViewCache(CCoinsView *baseIn); CCoinsViewCache(CCoinsView *baseIn);
// Standard CCoinsView methods // Standard CCoinsView methods
bool GetCoin(const COutPoint &outpoint, Coin &coin) const; bool GetCoin(const COutPoint &outpoint, Coin &coin) const override;
bool HaveCoin(const COutPoint &outpoint) const; bool HaveCoin(const COutPoint &outpoint) const override;
uint256 GetBestBlock() const; uint256 GetBestBlock() const override;
void SetBestBlock(const uint256 &hashBlock); void SetBestBlock(const uint256 &hashBlock);
bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock); bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) override;
CCoinsViewCursor* Cursor() const { CCoinsViewCursor* Cursor() const override {
throw std::logic_error("CCoinsViewCache cursor iteration not supported."); throw std::logic_error("CCoinsViewCache cursor iteration not supported.");
} }

View file

@ -37,7 +37,7 @@ class CCoinsViewTest : public CCoinsView
std::map<COutPoint, Coin> map_; std::map<COutPoint, Coin> map_;
public: public:
bool GetCoin(const COutPoint& outpoint, Coin& coin) const bool GetCoin(const COutPoint& outpoint, Coin& coin) const override
{ {
std::map<COutPoint, Coin>::const_iterator it = map_.find(outpoint); std::map<COutPoint, Coin>::const_iterator it = map_.find(outpoint);
if (it == map_.end()) { if (it == map_.end()) {
@ -51,15 +51,15 @@ public:
return true; return true;
} }
bool HaveCoin(const COutPoint& outpoint) const bool HaveCoin(const COutPoint& outpoint) const override
{ {
Coin coin; Coin coin;
return GetCoin(outpoint, coin); return GetCoin(outpoint, coin);
} }
uint256 GetBestBlock() const { return hashBestBlock_; } uint256 GetBestBlock() const override { return hashBestBlock_; }
bool BatchWrite(CCoinsMap& mapCoins, const uint256& hashBlock) bool BatchWrite(CCoinsMap& mapCoins, const uint256& hashBlock) override
{ {
for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end(); ) { for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end(); ) {
if (it->second.flags & CCoinsCacheEntry::DIRTY) { if (it->second.flags & CCoinsCacheEntry::DIRTY) {