Merge #20575: Do not run functions with necessary side-effects in assert()

5021810650 Make CanFlushToDisk a const member function (practicalswift)
281cf99554 Do not run functions with necessary side-effects in assert() (practicalswift)

Pull request description:

  Do not run functions with necessary side-effects in `assert()`.

ACKs for top commit:
  laanwj:
    Code review ACK 5021810650
  sipa:
    utACK 5021810650
  theStack:
    Code Review ACK 5021810650 🟢

Tree-SHA512: 38b7faccc2f16a499f9b7b1b962b49eb58580b2a2bbf63ea49dcc418a5ecc8f21a0972fa953f66db9509c7239af67cfa2f9266423fd220963d091034d7332b96
This commit is contained in:
Wladimir J. van der Laan
2020-12-16 22:58:42 +01:00
3 changed files with 9 additions and 5 deletions

View File

@ -562,7 +562,7 @@ public:
//! @returns whether or not the CoinsViews object has been fully initialized and we can
//! safely flush this object to disk.
bool CanFlushToDisk() EXCLUSIVE_LOCKS_REQUIRED(cs_main) {
bool CanFlushToDisk() const EXCLUSIVE_LOCKS_REQUIRED(cs_main) {
return m_coins_views && m_coins_views->m_cacheview;
}