diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -359,6 +359,7 @@ clientversion.cpp compat/glibcxx_sanity.cpp compat/strnlen.cpp + currencyunit.cpp fs.cpp interfaces/handler.cpp logging.cpp diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -48,6 +49,7 @@ const auto regtestBaseParams = CreateBaseChainParams(CBaseChainParams::REGTEST); + SetupCurrencyUnitOptions(argsman); argsman.AddArg("-version", "Print version and exit", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg( diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,7 @@ static void SetupBitcoinTxArgs(ArgsManager &argsman) { SetupHelpOptions(argsman); + SetupCurrencyUnitOptions(argsman); argsman.AddArg("-create", "Create new, empty TX.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-json", "Select JSON output", ArgsManager::ALLOW_ANY, diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp --- a/src/bitcoin-wallet.cpp +++ b/src/bitcoin-wallet.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -20,6 +21,7 @@ static void SetupWalletToolArgs(ArgsManager &argsman) { SetupHelpOptions(argsman); SetupChainParamsBaseOptions(argsman); + SetupCurrencyUnitOptions(argsman); argsman.AddArg("-datadir=", "Specify data directory", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); diff --git a/src/currencyunit.h b/src/currencyunit.h new file mode 100644 --- /dev/null +++ b/src/currencyunit.h @@ -0,0 +1,12 @@ +// Copyright (c) 2021 The Bitcoin Developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_CURRENCYUNIT_H +#define BITCOIN_CURRENCYUNIT_H + +class ArgsManager; + +void SetupCurrencyUnitOptions(ArgsManager &); + +#endif // BITCOIN_CURRENCYUNIT_H diff --git a/src/currencyunit.cpp b/src/currencyunit.cpp new file mode 100644 --- /dev/null +++ b/src/currencyunit.cpp @@ -0,0 +1,13 @@ +// Copyright (c) 2021 The Bitcoin Developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include + +void SetupCurrencyUnitOptions(ArgsManager &argsman) { + // whether to use eCash default unit and address prefix + argsman.AddArg("-ecash", "Use ecash as default unit (Default: false)", + ArgsManager::ALLOW_BOOL, OptionsCategory::OPTIONS); +} \ No newline at end of file diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -381,13 +382,11 @@ ArgsManager &argsman = *node.args; SetupHelpOptions(argsman); + SetupCurrencyUnitOptions(argsman); // server-only for now argsman.AddArg("-help-debug", "Print help message with debugging options and exit", false, OptionsCategory::DEBUG_TEST); - // whether to use eCash default unit and address prefix - argsman.AddArg("-ecash", "Use ecash as default unit (Default: false)", - ArgsManager::ALLOW_BOOL, OptionsCategory::OPTIONS); const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN);