mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 23:03:45 +01:00
Ensure m_tip_block is never ZERO
To avoid future code changes from reintroducing the ambiguity fixed by the previous commit, mark m_tip_block private and Assume that it's not set to uint256::ZERO.
This commit is contained in:
@@ -52,6 +52,7 @@ kernel::InterruptResult KernelNotifications::blockTip(SynchronizationState state
|
||||
{
|
||||
{
|
||||
LOCK(m_tip_block_mutex);
|
||||
Assume(index.GetBlockHash() != uint256::ZERO);
|
||||
m_tip_block = index.GetBlockHash();
|
||||
m_tip_block_cv.notify_all();
|
||||
}
|
||||
@@ -99,6 +100,13 @@ void KernelNotifications::fatalError(const bilingual_str& message)
|
||||
m_exit_status, message, &m_warnings);
|
||||
}
|
||||
|
||||
std::optional<uint256> KernelNotifications::TipBlock()
|
||||
{
|
||||
AssertLockHeld(m_tip_block_mutex);
|
||||
return m_tip_block;
|
||||
};
|
||||
|
||||
|
||||
void ReadNotificationArgs(const ArgsManager& args, KernelNotifications& notifications)
|
||||
{
|
||||
if (auto value{args.GetIntArg("-stopatheight")}) notifications.m_stop_at_height = *value;
|
||||
|
||||
Reference in New Issue
Block a user