diff --git a/src/Makefile.am b/src/Makefile.am index c952d737584..e2c7af8c583 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -279,6 +279,7 @@ BITCOIN_CORE_H = \ txorphanage.h \ txrequest.h \ undo.h \ + util/any.h \ util/asmap.h \ util/batchpriority.h \ util/bip32.h \ diff --git a/src/rest.cpp b/src/rest.cpp index dae064f89d5..c9e61d70bd0 100644 --- a/src/rest.cpp +++ b/src/rest.cpp @@ -24,8 +24,8 @@ #include #include #include +#include #include -#include #include #include diff --git a/src/rpc/node.cpp b/src/rpc/node.cpp index ca8db0f82a8..45d46d223ba 100644 --- a/src/rpc/node.cpp +++ b/src/rpc/node.cpp @@ -19,9 +19,9 @@ #include #include #include +#include #include #include -#include #include #ifdef HAVE_MALLOC_INFO diff --git a/src/rpc/server_util.cpp b/src/rpc/server_util.cpp index 13d007b4962..1d4afb3758c 100644 --- a/src/rpc/server_util.cpp +++ b/src/rpc/server_util.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/util/any.h b/src/util/any.h new file mode 100644 index 00000000000..4562c5bd8aa --- /dev/null +++ b/src/util/any.h @@ -0,0 +1,26 @@ +// Copyright (c) 2023 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_UTIL_ANY_H +#define BITCOIN_UTIL_ANY_H + +#include + +namespace util { + +/** + * Helper function to access the contained object of a std::any instance. + * Returns a pointer to the object if passed instance has a value and the type + * matches, nullptr otherwise. + */ +template +T* AnyPtr(const std::any& any) noexcept +{ + T* const* ptr = std::any_cast(&any); + return ptr ? *ptr : nullptr; +} + +} // namespace util + +#endif // BITCOIN_UTIL_ANY_H diff --git a/src/util/system.h b/src/util/system.h index 463713d565a..719cd28f979 100644 --- a/src/util/system.h +++ b/src/util/system.h @@ -13,7 +13,6 @@ #include #include -#include #include #include #include @@ -36,20 +35,4 @@ void runCommand(const std::string& strCommand); */ int GetNumCores(); -namespace util { - -/** - * Helper function to access the contained object of a std::any instance. - * Returns a pointer to the object if passed instance has a value and the type - * matches, nullptr otherwise. - */ -template -T* AnyPtr(const std::any& any) noexcept -{ - T* const* ptr = std::any_cast(&any); - return ptr ? *ptr : nullptr; -} - -} // namespace util - #endif // BITCOIN_UTIL_SYSTEM_H diff --git a/src/wallet/rpc/util.cpp b/src/wallet/rpc/util.cpp index 4ff44b84b07..06ec7db1bc2 100644 --- a/src/wallet/rpc/util.cpp +++ b/src/wallet/rpc/util.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include