mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-05 18:52:29 +02:00
util: Use compile-time check for FatalErrorf
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2017-2022 The Bitcoin Core developers
|
||||
// Copyright (c) 2017-present The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <node/database_args.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/string.h>
|
||||
#include <util/thread.h>
|
||||
#include <util/translation.h>
|
||||
#include <validation.h> // For g_chainman
|
||||
@@ -27,7 +28,7 @@ constexpr auto SYNC_LOG_INTERVAL{30s};
|
||||
constexpr auto SYNC_LOCATOR_WRITE_INTERVAL{30s};
|
||||
|
||||
template <typename... Args>
|
||||
void BaseIndex::FatalErrorf(const char* fmt, const Args&... args)
|
||||
void BaseIndex::FatalErrorf(util::ConstevalFormatString<sizeof...(Args)> fmt, const Args&... args)
|
||||
{
|
||||
auto message = tfm::format(fmt, args...);
|
||||
node::AbortNode(m_chain->context()->shutdown, m_chain->context()->exit_status, Untranslated(message), m_chain->context()->warnings.get());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2017-2022 The Bitcoin Core developers
|
||||
// Copyright (c) 2017-present The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <dbwrapper.h>
|
||||
#include <interfaces/chain.h>
|
||||
#include <util/string.h>
|
||||
#include <util/threadinterrupt.h>
|
||||
#include <validationinterface.h>
|
||||
|
||||
@@ -94,7 +95,7 @@ private:
|
||||
virtual bool AllowPrune() const = 0;
|
||||
|
||||
template <typename... Args>
|
||||
void FatalErrorf(const char* fmt, const Args&... args);
|
||||
void FatalErrorf(util::ConstevalFormatString<sizeof...(Args)> fmt, const Args&... args);
|
||||
|
||||
protected:
|
||||
std::unique_ptr<interfaces::Chain> m_chain;
|
||||
|
||||
Reference in New Issue
Block a user