mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 21:52:53 +02:00
Add a belt-and-suspenders feature, limit the amount of memory and cpu possible when unlucky or simply misconfigured. The worst case limit is roughly 400kB * 10,000 = 4GB, regardless of usage pattern. Before this change, sheer volume of broadcasts, mismatches in standardness rules, or simply fee mismatches may result in unbounded growth of memory usage. As the feature may be expanded in the future, explicit bounds helps reasoning going forward.
48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
// Copyright (c) 2010-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.
|
|
|
|
//! @file node/types.h is a home for public enum and struct type definitions
|
|
//! that are used internally by node code, but also used externally by wallet,
|
|
//! mining 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
|
|
|
|
#include <cstdint>
|
|
|
|
namespace node {
|
|
enum class TransactionError {
|
|
OK, //!< No error
|
|
MISSING_INPUTS,
|
|
ALREADY_IN_UTXO_SET,
|
|
MEMPOOL_REJECTED,
|
|
MEMPOOL_ERROR,
|
|
MAX_FEE_EXCEEDED,
|
|
MAX_BURN_EXCEEDED,
|
|
INVALID_PACKAGE,
|
|
PRIVATE_BROADCAST_FULL,
|
|
};
|
|
|
|
/**
|
|
* How to broadcast a local transaction.
|
|
* Used to influence `BroadcastTransaction()` and its callers.
|
|
*/
|
|
enum class TxBroadcast : uint8_t {
|
|
/// Add the transaction to the mempool and broadcast to all peers for which tx relay is enabled.
|
|
MEMPOOL_AND_BROADCAST_TO_ALL,
|
|
/// Add the transaction to the mempool, but don't broadcast to anybody.
|
|
MEMPOOL_NO_BROADCAST,
|
|
/// Omit the mempool and directly send the transaction via a few dedicated connections to
|
|
/// peers on privacy networks.
|
|
NO_MEMPOOL_PRIVATE_BROADCAST,
|
|
};
|
|
|
|
} // namespace node
|
|
|
|
#endif // BITCOIN_NODE_TYPES_H
|