mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 03:33:32 +01:00
Merge bitcoin/bitcoin#29015: kernel: Streamline util library
c7376babd1doc: Clarify distinction between util and common libraries in libraries.md (Ryan Ofsky)4f74c59334util: Move util/string.h functions to util namespace (Ryan Ofsky)4d05d3f3b4util: add TransactionError includes and namespace declarations (Ryan Ofsky)680eafdc74util: move fees.h and error.h to common/messages.h (Ryan Ofsky)02e62c6c9acommon: Add PSBTError enum (Ryan Ofsky)0d44c44ae3util: move error.h TransactionError enum to node/types.h (Ryan Ofsky)9bcce2608dutil: move spanparsing.h to script/parsing.h (Ryan Ofsky)6dd2ad4792util: move spanparsing.h Split functions to string.h (Ryan Ofsky)23cc8ddff4util: move HexStr and HexDigit from util to crypto (TheCharlatan)6861f954f8util: move util/message to common/signmessage (Ryan Ofsky)cc5f29fbeabuild: move memory_cleanse from util to crypto (Ryan Ofsky)5b9309420cbuild: move chainparamsbase from util to common (Ryan Ofsky)ffa27af24dtest: Add check-deps.sh script to check for unexpected library dependencies (Ryan Ofsky) Pull request description: Remove `fees.h`, `errors.h`, and `spanparsing.h` from the util library. Specifically: - Move `Split` functions from `util/spanparsing.h` to `util/string.h`, using `util` namespace for clarity. - Move remaining spanparsing functions to `script/parsing.h` since they are used for descriptor and miniscript parsing. - Combine `util/fees.h` and `util/errors.h` into `common/messages.h` so there is a place for simple functions that generate user messages to live, and these functions are not part of the util library. Motivation for this change is that the util library is a dependency of the kernel, and we should remove functionality from util that shouldn't be called by kernel code or kernel applications. These changes should also improve code organization and make functions easier to discover. Some of these same moves are (or were) part of #28690, but did not help with code organization, or made it worse, so it is better to move them and clean them up in the same PR so code only has to change one time. ACKs for top commit: achow101: ACKc7376babd1TheCharlatan: Re-ACKc7376babd1hebasto: re-ACKc7376babd1. Tree-SHA512: 5bcef16c1255463b1b69270548711e7ff78ca0dd34e300b95e3ca1ce52ceb34f83d9ddb2839e83800ba36b200de30396e504bbb04fa02c6d0c24a16d06ae523d
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
#include <boost/signals2/optional_last_value.hpp>
|
||||
#include <boost/signals2/signal.hpp>
|
||||
|
||||
using util::MakeUnorderedList;
|
||||
|
||||
CClientUIInterface uiInterface;
|
||||
|
||||
struct UISignals {
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <node/interface_ui.h>
|
||||
#include <node/mini_miner.h>
|
||||
#include <node/transaction.h>
|
||||
#include <node/types.h>
|
||||
#include <policy/feerate.h>
|
||||
#include <policy/fees.h>
|
||||
#include <policy/policy.h>
|
||||
@@ -70,6 +71,7 @@ using interfaces::Handler;
|
||||
using interfaces::MakeSignalHandler;
|
||||
using interfaces::Node;
|
||||
using interfaces::WalletLoader;
|
||||
using util::Join;
|
||||
|
||||
namespace node {
|
||||
// All members of the classes in this namespace are intentionally public, as the
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
using util::ReplaceAll;
|
||||
|
||||
static void AlertNotify(const std::string& strMessage)
|
||||
{
|
||||
uiInterface.NotifyAlertChanged();
|
||||
|
||||
@@ -8,19 +8,20 @@
|
||||
#include <kernel/mempool_options.h>
|
||||
|
||||
#include <common/args.h>
|
||||
#include <common/messages.h>
|
||||
#include <consensus/amount.h>
|
||||
#include <kernel/chainparams.h>
|
||||
#include <logging.h>
|
||||
#include <policy/feerate.h>
|
||||
#include <policy/policy.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/error.h>
|
||||
#include <util/moneystr.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
|
||||
using common::AmountErrMsg;
|
||||
using kernel::MemPoolLimits;
|
||||
using kernel::MemPoolOptions;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <net_processing.h>
|
||||
#include <node/blockstorage.h>
|
||||
#include <node/context.h>
|
||||
#include <node/types.h>
|
||||
#include <txmempool.h>
|
||||
#include <validation.h>
|
||||
#include <validationinterface.h>
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#ifndef BITCOIN_NODE_TRANSACTION_H
|
||||
#define BITCOIN_NODE_TRANSACTION_H
|
||||
|
||||
#include <common/messages.h>
|
||||
#include <policy/feerate.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <util/error.h>
|
||||
|
||||
class CBlockIndex;
|
||||
class CTxMemPool;
|
||||
|
||||
29
src/node/types.h
Normal file
29
src/node/types.h
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2010-2021 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
//! @file node/types.h is a home for public enum and struct type definitions
|
||||
//! that are used by internally by node code, but also used externally by wallet
|
||||
//! or GUI code.
|
||||
//!
|
||||
//! This file is intended to define only simple types that do not have external
|
||||
//! dependencies. More complicated types should be defined in dedicated header
|
||||
//! files.
|
||||
|
||||
#ifndef BITCOIN_NODE_TYPES_H
|
||||
#define BITCOIN_NODE_TYPES_H
|
||||
|
||||
namespace node {
|
||||
enum class TransactionError {
|
||||
OK, //!< No error
|
||||
MISSING_INPUTS,
|
||||
ALREADY_IN_CHAIN,
|
||||
MEMPOOL_REJECTED,
|
||||
MEMPOOL_ERROR,
|
||||
MAX_FEE_EXCEEDED,
|
||||
MAX_BURN_EXCEEDED,
|
||||
INVALID_PACKAGE,
|
||||
};
|
||||
} // namespace node
|
||||
|
||||
#endif // BITCOIN_NODE_TYPES_H
|
||||
Reference in New Issue
Block a user