1 // Copyright (c) 2010-2021 The Limenka developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 5 //! @file node/types.h is a home for public enum and struct type definitions
6 //! that are used internally by node code, but also used externally by wallet,
7 //! mining or GUI code.
8 //!
9 //! This file is intended to define only simple types that do not have external
10 //! dependencies. More complicated types should be defined in dedicated header
11 //! files.
12 13 #ifndef LIMENKA_NODE_TYPES_H
14 #define LIMENKA_NODE_TYPES_H
15 16 #include <policy/feerate.h>
17 #include <policy/policy.h>
18 19 #include <cstddef>
20 #include <policy/policy.h>
21 #include <script/script.h>
22 23 namespace node {
24 enum class TransactionError {
25 OK, //!< No error
26 MISSING_INPUTS,
27 ALREADY_IN_UTXO_SET,
28 MEMPOOL_REJECTED,
29 MEMPOOL_ERROR,
30 MAX_FEE_EXCEEDED,
31 MAX_BURN_EXCEEDED,
32 INVALID_PACKAGE,
33 };
34 35 static const bool DEFAULT_PRINT_MODIFIED_FEE = false;
36 37 struct BlockCreateOptions {
38 /**
39 * Set false to omit mempool transactions
40 */
41 bool use_mempool{true};
42 /**
43 * The default reserved size for the fixed-size block header,
44 * transaction count and coinbase transaction.
45 */
46 size_t block_reserved_size{DEFAULT_BLOCK_RESERVED_SIZE};
47 /**
48 * The default reserved weight for the fixed-size block header,
49 * transaction count and coinbase transaction.
50 */
51 size_t block_reserved_weight{DEFAULT_BLOCK_RESERVED_WEIGHT};
52 /**
53 * The maximum additional sigops which the pool will add in coinbase
54 * transaction outputs.
55 */
56 size_t coinbase_output_max_additional_sigops{400};
57 /**
58 * Script to put in the coinbase transaction. The default is an
59 * anyone-can-spend dummy.
60 *
61 * Should only be used for tests, when the default doesn't suffice.
62 *
63 * Note that higher level code like the getblocktemplate RPC may omit the
64 * coinbase transaction entirely. It's instead constructed by pool software
65 * using fields like coinbasevalue, coinbaseaux and default_witness_commitment.
66 * This software typically also controls the payout outputs, even for solo
67 * mining.
68 *
69 * The size and sigops are not checked against
70 * coinbase_max_additional_weight and coinbase_output_max_additional_sigops.
71 */
72 CScript coinbase_output_script{CScript() << OP_TRUE};
73 74 // Configuration parameters for the block size
75 size_t nBlockMaxWeight{DEFAULT_BLOCK_MAX_WEIGHT};
76 size_t nBlockMaxSize{DEFAULT_BLOCK_MAX_SIZE};
77 CFeeRate blockMinFeeRate{DEFAULT_BLOCK_MIN_TX_FEE};
78 // Whether to call TestBlockValidity() at the end of CreateNewBlock().
79 bool test_block_validity{true};
80 bool print_modified_fee{DEFAULT_PRINT_MODIFIED_FEE};
81 82 BlockCreateOptions Clamped() const;
83 84 friend bool operator==(const BlockCreateOptions& a, const BlockCreateOptions& b) noexcept = default;
85 };
86 } // namespace node
87 88 #endif // LIMENKA_NODE_TYPES_H
89