This simplifies the shutdown code a bit and allows for getting rid of the goto
in bitcoin-chainstate
as well as making it a bit easier to use for future users of the kernel library.
Moving the second flush out of the Shutdown function into the ChainstateManager destructor, should be safe since there should be no new events created after the first flush. Tweak the chainman tests to actually exercise this new tear down behaviour.
This PR is part of the libbitcoinkernel project