mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-13 14:13:52 +02:00
Both are fine and this refactor shouldn't change any behavior.
However, inline constexpr will ensure each symbol has a single address
across all TU, making the release binary smaller.
Note, a follow-up commit will deal with string literals (const char*)
and other static const, which can not be constexpr (e.g. std::vector).
-BEGIN VERIFY SCRIPT-
# Limit to types that can be constexpr
type='bool|CAmount|size_t|((signed|unsigned) )?int|u?int[0-9]+_t|std::array|DatabaseFormat|CFeeRate|std::streamsize'
sed -i --regexp-extended "s/^(static )?const (${type})\>/inline constexpr \2/" $( \
git grep -l --extended-regexp "^(static )?const " -- \
'*.h' \
':(exclude)src/leveldb' \
':(exclude)src/secp256k1' \
)
-END VERIFY SCRIPT-
38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
// Copyright (c) The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_NODE_MINING_ARGS_H
|
|
#define BITCOIN_NODE_MINING_ARGS_H
|
|
|
|
#include <node/mining_types.h>
|
|
#include <util/result.h>
|
|
|
|
class ArgsManager;
|
|
|
|
namespace node {
|
|
|
|
inline constexpr bool DEFAULT_PRINT_MODIFIED_FEE = false;
|
|
|
|
/**
|
|
* Read the mining options set in \p args. Returns an error if one was
|
|
* encountered.
|
|
*/
|
|
[[nodiscard]] util::Result<BlockCreateOptions> ReadMiningArgs(const ArgsManager& args);
|
|
|
|
/** Check option values for validity. Returns an error for invalid values. */
|
|
[[nodiscard]] util::Result<void> CheckMiningOptions(BlockCreateOptions options, bool use_argnames);
|
|
|
|
/** Replace null optional values with their hardcoded defaults. */
|
|
[[nodiscard]] BlockCreateOptions FlattenMiningOptions(BlockCreateOptions options);
|
|
|
|
/**
|
|
* Merge two BlockCreateOptions structs, replacing null values in \p x with
|
|
* non-null values from \p y.
|
|
*/
|
|
[[nodiscard]] BlockCreateOptions MergeMiningOptions(BlockCreateOptions x, const BlockCreateOptions& y);
|
|
|
|
} // namespace node
|
|
|
|
#endif // BITCOIN_NODE_MINING_ARGS_H
|