mining_args.h raw
1 // Copyright (c) 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
5 #ifndef BITCOIN_NODE_MINING_ARGS_H
6 #define BITCOIN_NODE_MINING_ARGS_H
7
8 #include <node/mining_types.h>
9 #include <util/result.h>
10
11 class ArgsManager;
12
13 namespace node {
14
15 static const bool DEFAULT_PRINT_MODIFIED_FEE = false;
16
17 /**
18 * Read the mining options set in \p args. Returns an error if one was
19 * encountered.
20 */
21 [[nodiscard]] util::Result<BlockCreateOptions> ReadMiningArgs(const ArgsManager& args);
22
23 /** Check option values for validity. Returns an error for invalid values. */
24 [[nodiscard]] util::Result<void> CheckMiningOptions(BlockCreateOptions options, bool use_argnames);
25
26 /** Replace null optional values with their hardcoded defaults. */
27 [[nodiscard]] BlockCreateOptions FlattenMiningOptions(BlockCreateOptions options);
28
29 /**
30 * Merge two BlockCreateOptions structs, replacing null values in \p x with
31 * non-null values from \p y.
32 */
33 [[nodiscard]] BlockCreateOptions MergeMiningOptions(BlockCreateOptions x, const BlockCreateOptions& y);
34
35 } // namespace node
36
37 #endif // BITCOIN_NODE_MINING_ARGS_H
38