mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-23 06:55:37 +02:00
coins: assume entry is dirty in Next and Prev
This commit is contained in:
parent
2c3e62d452
commit
147cd50501
@ -181,17 +181,15 @@ public:
|
||||
bool IsDirty() const noexcept { return m_flags & DIRTY; }
|
||||
bool IsFresh() const noexcept { return m_flags & FRESH; }
|
||||
|
||||
//! Only call Next when this entry is DIRTY, FRESH, or both
|
||||
CoinsCachePair* Next() const noexcept
|
||||
{
|
||||
Assume(m_flags);
|
||||
Assume(IsDirty());
|
||||
return m_next;
|
||||
}
|
||||
|
||||
//! Only call Next when this entry is DIRTY, FRESH, or both
|
||||
CoinsCachePair* Prev() const noexcept
|
||||
{
|
||||
Assume(m_flags);
|
||||
Assume(IsDirty());
|
||||
return m_prev;
|
||||
}
|
||||
|
||||
|
@ -154,9 +154,10 @@ BOOST_AUTO_TEST_CASE(linked_list_set_state)
|
||||
BOOST_CHECK_EQUAL(sentinel.second.Next(), &n1);
|
||||
BOOST_CHECK_EQUAL(sentinel.second.Prev(), &n1);
|
||||
|
||||
// Check that setting FRESH on new node inserts it after n1
|
||||
// Check that setting DIRTY and FRESH on new node inserts it after n1
|
||||
CCoinsCacheEntry::SetDirty(n2, sentinel);
|
||||
CCoinsCacheEntry::SetFresh(n2, sentinel);
|
||||
BOOST_CHECK(n2.second.IsFresh() && !n2.second.IsDirty());
|
||||
BOOST_CHECK(n2.second.IsDirty() && n2.second.IsFresh());
|
||||
BOOST_CHECK_EQUAL(n2.second.Next(), &sentinel);
|
||||
BOOST_CHECK_EQUAL(n2.second.Prev(), &n1);
|
||||
BOOST_CHECK_EQUAL(n1.second.Next(), &n2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user