Bitcoin Core  31.0.0
P2P Digital Currency
types.h
Go to the documentation of this file.
1 // Copyright (c) 2010-present The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
12 
13 #ifndef BITCOIN_NODE_TYPES_H
14 #define BITCOIN_NODE_TYPES_H
15 
16 #include <consensus/amount.h>
17 #include <cstddef>
18 #include <cstdint>
19 #include <optional>
20 #include <policy/policy.h>
21 #include <primitives/transaction.h>
22 #include <script/script.h>
23 #include <uint256.h>
24 #include <util/time.h>
25 #include <vector>
26 
27 namespace node {
28 enum class TransactionError {
29  OK,
37 };
38 
43  bool use_mempool{true};
53  std::optional<size_t> block_reserved_weight{};
79 };
80 
86  MillisecondsDouble timeout{MillisecondsDouble::max()};
87 
100 };
101 
106  bool check_merkle_root{true};
107 
111  bool check_pow{true};
112 };
113 
119 struct CoinbaseTx {
120  /* nVersion */
121  uint32_t version;
122  /* nSequence for the only coinbase transaction input */
123  uint32_t sequence;
142  std::optional<uint256> witness;
150  /*
151  * To be included as the last outputs in the coinbase transaction.
152  * Currently this is only the witness commitment OP_RETURN, but future
153  * softforks or a custom mining patch could add more.
154  *
155  * The dummy output that spends the full reward is excluded.
156  */
157  std::vector<CTxOut> required_outputs;
158  uint32_t lock_time;
159 };
160 
165 enum class TxBroadcast : uint8_t {
173 };
174 
175 } // namespace node
176 
177 #endif // BITCOIN_NODE_TYPES_H
TransactionError
Definition: types.h:28
TxBroadcast
How to broadcast a local transaction.
Definition: types.h:165
std::vector< CTxOut > required_outputs
Definition: types.h:157
Omit the mempool and directly send the transaction via a few dedicated connections to peers on privac...
CAmount block_reward_remaining
Block subsidy plus fees, minus any non-zero required_outputs.
Definition: types.h:149
std::optional< uint256 > witness
The first (and only) witness stack element of the coinbase input.
Definition: types.h:142
size_t coinbase_output_max_additional_sigops
The maximum additional sigops which the pool will add in coinbase transaction outputs.
Definition: types.h:58
Add the transaction to the mempool and broadcast to all peers for which tx relay is enabled...
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
CAmount fee_threshold
The wait method will not return a new template unless it has fees at least fee_threshold sats higher ...
Definition: types.h:99
CScript script_sig_prefix
Prefix which needs to be placed at the beginning of the scriptSig.
Definition: types.h:133
Definition: script.h:84
Template containing all coinbase transaction fields that are set by our miner code.
Definition: types.h:119
static constexpr unsigned int DEFAULT_COINBASE_OUTPUT_MAX_ADDITIONAL_SIGOPS
Default sigops cost to reserve for coinbase transaction outputs when creating block templates...
Definition: policy.h:28
uint32_t sequence
Definition: types.h:123
uint32_t lock_time
Definition: types.h:158
Definition: messages.h:21
CScript coinbase_output_script
Script to put in the coinbase transaction.
Definition: types.h:74
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:404
bool use_mempool
Set false to omit mempool transactions.
Definition: types.h:43
bool check_pow
Set false to omit the proof-of-work check.
Definition: types.h:111
Add the transaction to the mempool, but don&#39;t broadcast to anybody.
static constexpr CAmount MAX_MONEY
No amount larger than this (in satoshi) is valid.
Definition: amount.h:26
bool check_merkle_root
Set false to omit the merkle root check.
Definition: types.h:106
bool include_dummy_extranonce
Whether to include an OP_0 as a dummy extraNonce in the template&#39;s coinbase.
Definition: types.h:78
uint32_t version
Definition: types.h:121
std::chrono::duration< double, std::chrono::milliseconds::period > MillisecondsDouble
Definition: time.h:94
MillisecondsDouble timeout
How long to wait before returning nullptr instead of a new template.
Definition: types.h:86
std::optional< size_t > block_reserved_weight
The default reserved weight for the fixed-size block header, transaction count and coinbase transacti...
Definition: types.h:53