kernel: Remove StartShutdown calls from validation code

This change drops the last kernel dependency on shutdown.cpp. It also adds new
hooks for libbitcoinkernel applications to be able to interrupt kernel
operations when the chain tip changes.

This is a refactoring that does not affect behavior. (Looking at the code it
can appear like the new break statement in the ActivateBestChain function is a
change in behavior, but actually the previous StartShutdown call was indirectly
triggering a break before, because it was causing m_chainman.m_interrupt to be
true. The new code just makes the break more obvious.)
This commit is contained in:
Ryan Ofsky
2023-07-07 12:53:31 -04:00
parent 99b3af78bd
commit 31eca93a9e
10 changed files with 55 additions and 16 deletions

View File

@@ -81,9 +81,10 @@ int main(int argc, char* argv[])
class KernelNotifications : public kernel::Notifications
{
public:
void blockTip(SynchronizationState, CBlockIndex&) override
kernel::InterruptResult blockTip(SynchronizationState, CBlockIndex&) override
{
std::cout << "Block tip changed" << std::endl;
return {};
}
void headerTip(SynchronizationState, int64_t height, int64_t timestamp, bool presync) override
{