aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoind.cpp
AgeCommit message (Collapse)Author
2018-06-12Add unavailable options to hidden options categoryAndrew Chow
Options that are not available (but known in the source code) will cause an error if they are specified. Make these options "available" by adding them to the hidden options category to prevent conf files from failing when shared between binaries that have different options available.
2018-05-30Give an error and exit if there are unknown parametersAndrew Chow
If an unknown option is given via either the command line args or the conf file, throw an error and exit Update tests for ArgsManager knowing args Ignore unknown options in the config file for bitcoin-cli Fix tests and bitcoin-cli to match actual options used
2018-05-30Stop translating command line optionsWladimir J. van der Laan
Many options are extremely technical, and refer internals, making it difficult to translate usefully. This came up in discussion of e.g. #10949. If a message is not understood by translators (which are typically end-users, not developers) they'll either translate it literally, making it harder to understand instead of easier, with the added drawback of the user no longer being able to google it. Also the translation was only working for bitcoin-qt as with the console programs, there is no translation backend. So it was injecting never-used translation messages for bitcoin-cli, -tx. For these reasons, stop translating options help completely. This should not affect the output **in any way** except for bitcoin-qt when a non-English language is configured in the locale. This implements #10962.
2018-05-09Make gArgs aware of the argumentsAndrew Chow
gArgs knows what the available arguments are and their help. Getting the help message is moved to gArgs and HelpMessage() is removed
2018-05-09Merge #10267: New -includeconf argument for including external configuration ↵Wladimir J. van der Laan
files 25b7ab9 doc: Add release notes for -includeconf (Karl-Johan Alm) 0f0badd test: Test includeconf parameter. (Karl-Johan Alm) 629ff8c -includeconf=<path> support in config handler, for including external configuration files (Karl-Johan Alm) Pull request description: Fixes: #10071. Done: - adds `-includeconf=<path>`, where `<path>` is relative to `datadir` or to the path of the file being read, if in a file - protects against circular includes - updates help docs ~~~Thoughts:~~~ - ~~~I am not sure how to test this in a neat manner. Feedback on this would be nice. Will dig/think though.~~~ Tree-SHA512: cb31f1b2f69fbc0890d264948eb2e501ac05cf12f5e06a5942f9c1539eb15ea8dc3cae817f4073aecb2fcc21d0386747f14f89d990772003a76e2a6d25642553
2018-05-03Make it clear which functions that are intended to be translation unit localpracticalswift
Do not share functions that are meant to be translation unit local with other translation units. Use internal linkage for those consistently.
2018-04-26-includeconf=<path> support in config handler, for including external ↵Karl-Johan Alm
configuration files
2018-04-16net: Minor accumulated cleanupsThomas Snider
2018-04-11Ignore macOS daemon() depracation warningJonas Schnelli
2018-04-08Merge #12878: [refactor] Config handling refactoring in preparation for ↵Jonas Schnelli
network-specific sections 77a733a99 [tests] Add additional unit tests for -nofoo edge cases (Anthony Towns) af173c2be [tests] Check GetChainName works with config entries (Anthony Towns) fa27f1c23 [tests] Add unit tests for ReadConfigStream (Anthony Towns) 087c5d204 ReadConfigStream: assume the stream is good (Anthony Towns) 6d5815aad Separate out ReadConfigStream from ReadConfigFile (Anthony Towns) 834d30341 [tests] Add unit tests for GetChainName (Anthony Towns) 11b6b5b86 Move ChainNameFromCommandLine into ArgsManager and rename to GetChainName (Anthony Towns) Pull request description: This does a bit of refactoring of the configuration handling code in order to add additional tests to make adding support for [test]/[regtest] sections in the config file in #11862 easier. Should not cause any behaviour changes. Tree-SHA512: 8d2ce1449fc180de03414e7e569d1a21ba1e9f6564e13d3faf3961f710adc725fa0d4ab49b89ebd2baa11ea36ac5018377f693a84037d386a8b8697c9d6db3e9
2018-04-05wallet: Make WalletInitInterface and DummyWalletInit privateJoão Barbosa
2018-04-06Move ChainNameFromCommandLine into ArgsManager and rename to GetChainNameAnthony Towns
2018-04-02[moveonly] Extract HelpRequested to dry up the help options testingBen Woosley
This ensures consistency across interfaces and makes the version handling more clear.
2018-03-29Merge #10762: [wallet] Remove Wallet dependencies from init.cppWladimir J. van der Laan
c7ec524 [wallet] Add dummy wallet init class (John Newbery) 49baa4a [wallet] Use global g_wallet_init_interface to init/destroy the wallet. (John Newbery) caaf972 [wallet] Create wallet init interface. (John Newbery) 5fb5421 [wallet] Move wallet init functions into WalletInit class. (John Newbery) Pull request description: This continues the work of #7965. This PR, along with several others, would remove the remaining dependencies from libbitcoin_server.a on libbitcoin_wallet.a. To create the interface, I've just translated all the old init.cpp wallet function calls into an interface class. I've not done any thinking about whether it makes sense to change that interface by combining/splitting those calls. This is a purely internal interface, so there's no problem in changing it later. Tree-SHA512: 32ea57615229c33fd1a7f2f29ebc11bf30337685f7211baffa899823ef74b65dcbf068289c557a161c5afffb51fdc38a2ee8180720371f64d433b12b0615cf3f
2018-03-27[wallet] Add dummy wallet init classJohn Newbery
2018-03-27[wallet] Use global g_wallet_init_interface to init/destroy the wallet.John Newbery
This commit creates a global g_wallet_init_interface, which is created in bitcoind and bitcoin-qt. g_wallet_init_interface is used to init and destroy the wallet. This removes the dependency from init.cpp on the wallet library.
2018-03-09scripted-diff: Convert 11 enums into scoped enums (C++11)practicalswift
-BEGIN VERIFY SCRIPT- sed -i 's/enum DBErrors/enum class DBErrors/g' src/wallet/walletdb.h git grep -l DB_ | xargs sed -i 's/DB_\(LOAD_OK\|CORRUPT\|NONCRITICAL_ERROR\|TOO_NEW\|LOAD_FAIL\|NEED_REWRITE\)/DBErrors::\1/g' sed -i 's/^ DBErrors::/ /g' src/wallet/walletdb.h sed -i 's/enum VerifyResult/enum class VerifyResult/g' src/wallet/db.h sed -i 's/\(VERIFY_OK\|RECOVER_OK\|RECOVER_FAIL\)/VerifyResult::\1/g' src/wallet/db.cpp sed -i 's/enum ThresholdState/enum class ThresholdState/g' src/versionbits.h git grep -l THRESHOLD_ | xargs sed -i 's/THRESHOLD_\(DEFINED\|STARTED\|LOCKED_IN\|ACTIVE\|FAILED\)/ThresholdState::\1/g' sed -i 's/^ ThresholdState::/ /g' src/versionbits.h sed -i 's/enum SigVersion/enum class SigVersion/g' src/script/interpreter.h git grep -l SIGVERSION_ | xargs sed -i 's/SIGVERSION_\(BASE\|WITNESS_V0\)/SigVersion::\1/g' sed -i 's/^ SigVersion::/ /g' src/script/interpreter.h sed -i 's/enum RetFormat {/enum class RetFormat {/g' src/rest.cpp sed -i 's/RF_\(UNDEF\|BINARY\|HEX\|JSON\)/RetFormat::\1/g' src/rest.cpp sed -i 's/^ RetFormat::/ /g' src/rest.cpp sed -i 's/enum HelpMessageMode {/enum class HelpMessageMode {/g' src/init.h git grep -l HMM_ | xargs sed -i 's/HMM_BITCOIN/HelpMessageMode::BITCOIN/g' sed -i 's/^ HelpMessageMode::/ /g' src/init.h sed -i 's/enum FeeEstimateHorizon/enum class FeeEstimateHorizon/g' src/policy/fees.h sed -i 's/enum RBFTransactionState/enum class RBFTransactionState/g' src/policy/rbf.h git grep -l RBF_ | xargs sed -i 's/RBF_TRANSACTIONSTATE_\(UNKNOWN\|REPLACEABLE_BIP125\|FINAL\)/RBFTransactionState::\1/g' sed -i 's/^ RBFTransactionState::/ /g' src/policy/rbf.h sed -i 's/enum BlockSource {/enum class BlockSource {/g' src/qt/clientmodel.h git grep -l BLOCK_SOURCE_ | xargs sed -i 's/BLOCK_SOURCE_\(NONE\|REINDEX\|DISK\|NETWORK\)/BlockSource::\1/g' sed -i 's/^ BlockSource::/ /g' src/qt/clientmodel.h sed -i 's/enum FlushStateMode {/enum class FlushStateMode {/g' src/validation.cpp sed -i 's/FLUSH_STATE_\(NONE\|IF_NEEDED\|PERIODIC\|ALWAYS\)/FlushStateMode::\1/g' src/validation.cpp sed -i 's/^ FlushStateMode::/ /g' src/validation.cpp sed -i 's/enum WitnessMode {/enum class WitnessMode {/g' src/test/script_tests.cpp sed -i 's/WITNESS_\(NONE\|PKH\|SH\)/WitnessMode::\1/g' src/test/script_tests.cpp sed -i 's/^ WitnessMode::/ /g' src/test/script_tests.cpp -END VERIFY SCRIPT-
2018-01-25Move scheduler/threadGroup into common-init instead of per-appMatt Corallo
This resolves #12229 which pointed out a shutdown deadlock due to scheduler/checkqueue having been shut down while network message processing is still running.
2018-01-03Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa
2017-11-16scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider
-BEGIN VERIFY SCRIPT- for f in \ src/*.cpp \ src/*.h \ src/bench/*.cpp \ src/bench/*.h \ src/compat/*.cpp \ src/compat/*.h \ src/consensus/*.cpp \ src/consensus/*.h \ src/crypto/*.cpp \ src/crypto/*.h \ src/crypto/ctaes/*.h \ src/policy/*.cpp \ src/policy/*.h \ src/primitives/*.cpp \ src/primitives/*.h \ src/qt/*.cpp \ src/qt/*.h \ src/qt/test/*.cpp \ src/qt/test/*.h \ src/rpc/*.cpp \ src/rpc/*.h \ src/script/*.cpp \ src/script/*.h \ src/support/*.cpp \ src/support/*.h \ src/support/allocators/*.h \ src/test/*.cpp \ src/test/*.h \ src/wallet/*.cpp \ src/wallet/*.h \ src/wallet/test/*.cpp \ src/wallet/test/*.h \ src/zmq/*.cpp \ src/zmq/*.h do base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f done -END VERIFY SCRIPT-
2017-10-16Init: Remove redundant exit(EXIT_FAILURE) instances and replace with return ↵donaloconnor
false
2017-08-14scripted-diff: stop using the gArgs wrappersMarko Bencun
They were temporary additions to ease the transition. -BEGIN VERIFY SCRIPT- find src/ -name "*.cpp" ! -wholename "src/util.h" ! -wholename "src/util.cpp" | xargs perl -i -pe 's/(?<!\.)(ParseParameters|ReadConfigFile|IsArgSet|(Soft|Force)?(Get|Set)(|Bool|)Arg(s)?)\(/gArgs.\1(/g' -END VERIFY SCRIPT-
2017-08-14Merge #10483: scripted-diff: Use the C++11 keyword nullptr to denote the ↵Wladimir J. van der Laan
pointer literal instead of the macro NULL 90d4d89 scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL (practicalswift) Pull request description: Since C++11 the macro `NULL` may be: * an integer literal with value zero, or * a prvalue of type `std::nullptr_t` By using the C++11 keyword `nullptr` we are guaranteed a prvalue of type `std::nullptr_t`. For a more thorough discussion, see "A name for the null pointer: nullptr" (Sutter & Stroustrup), http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf With this patch applied there are no `NULL` macro usages left in the repo: ``` $ git grep NULL -- "*.cpp" "*.h" | egrep -v '(/univalue/|/secp256k1/|/leveldb/|_NULL|NULLDUMMY|torcontrol.*NULL|NULL cert)' | wc -l 0 ``` The road towards `nullptr` (C++11) is split into two PRs: * `NULL` → `nullptr` is handled in PR #10483 (scripted, this PR) * `0` → `nullptr` is handled in PR #10645 (manual) Tree-SHA512: 3c395d66f2ad724a8e6fed74b93634de8bfc0c0eafac94e64e5194c939499fefd6e68f047de3083ad0b4eff37df9a8a3a76349aa17d55eabbd8e0412f140a297
2017-08-07scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift
instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
2017-08-01Always wait for threadGroup to exit in bitcoind shutdownMatt Corallo
This resolves a possible-assert-on-shutdown race introduced in 1f668b646806f94acd851acdbd9939c24e0492d3 when early shutdown occurs. Previously this was not done to avoid any cases where the threadGroup might not exit due to a blocking thread, but at this point the threadGroup isn't used all that much, plus Qt already does this, and its good to keep their init/shutdown consistent. For those curious, the threadGroup is only used in a few places: * Its used to run the CCheckQueues in script validation, but these use the boost mutex/condition variable primitives, so they respect the interrupt pretty trivially. * Its used for the import thread, which should exit rather quickly as mostly it just calls LoadExternalBlockFile, which has an interruption_point right before each block loaded. * Its used in the scheduler thread, which is only used for: * validationinterface has an effectively-dummy reference to it. * wallet compaction, which should not last long * addr/banlist dumping from CConnman, which should also be fast
2017-07-17init: Factor out AppInitLockDataDirectoryWladimir J. van der Laan
Alternative to #10818, alternative solution to #10815. After this change: All the AppInit steps before and inclusive AppInitLockDataDirectory must not have Shutdown() called in case of failure. Only when AppInitMain fails, Shutdown should be called. Changes the GUI and bitcoind code to consistently do this.
2017-06-09Remove unused Boost includespracticalswift
2017-05-24Make bitcoind invalid argument error message specificWladimir J. van der Laan
The current message is not helpful. Hardly anyone even remembers that bitcoind used to be a cli utility, let alone new users. Print what the actual problem is.
2017-04-03Replace uses of boost::filesystem with fsWladimir J. van der Laan
Step two in abstracting away boost::filesystem. To repeat this, simply run: ``` git ls-files \*.cpp \*.h | xargs sed -i 's/boost::filesystem/fs/g' ```
2017-04-03Replace includes of boost/filesystem.h with fs.hWladimir J. van der Laan
This is step one in abstracting the use of boost::filesystem.
2017-02-21use EXIT_ codes instead of magic numbersMarko Bencun
To be consistent with other exit() calls.
2016-12-31Increment MIT Licence copyright header year on files modified in 2016isle2983
Edited via: $ contrib/devtools/copyright_header.py update .
2016-12-24Un-expose mapArgs from utils.hMatt Corallo
2016-12-23Introduce (and use) an IsArgSet accessor methodMatt Corallo
2016-12-23Remove arguments to ParseConfigFileMatt Corallo
2016-11-30Merge #9010: Split up AppInit2 into multiple phases, daemonize after datadir ↵Pieter Wuille
lock errors deec83f init: Get rid of fServer flag (Wladimir J. van der Laan) 16ca0bf init: Try to aquire datadir lock before and after daemonization (Wladimir J. van der Laan) 0cc8b6b init: Split up AppInit2 into multiple phases (Wladimir J. van der Laan)
2016-11-29init: Split up AppInit2 into multiple phasesWladimir J. van der Laan
This allows doing some of the steps before e.g. daemonization and some fater.
2016-11-07Every main()/exit() should return/use one of EXIT_ codes instead of magic ↵UdjinM6
numbers
2016-11-04Fix exit codes:UdjinM6
- `--help`, `--version` etc should exit with `0` i.e. no error ("not enough args" case should still trigger an error) - error reading config file should exit with `1` Slightly refactor AppInitRPC/AppInitRawTx to return standard exit codes (EXIT_FAILURE/EXIT_SUCCESS) or CONTINUE_EXECUTION (-1)
2016-10-01Globals: Decouple GetConfigFile and ReadConfigFile from global mapArgsJorge Timón
2016-09-26bitcoind: Daemonize using daemon(3)Matthew King
Simplified version of #8278. Assumes that every OS that (a) is supported by Bitcoin Core (b) supports daemonization has the `daemon()` function in its C library. - Removes the fallback path for operating systems that support daemonization but not `daemon()`. This prevents never-exercised code from ending up in the repository (see discussion here: https://github.com/bitcoin/bitcoin/pull/8278#issuecomment-242704745). - Removes the windows-specific path. Windows doesn't support `daemon()`, so it don't support daemonization there, automatically. Original code by Matthew King, adapted by Wladimir van der Laan.
2016-09-04trivial: remove unnecessary variable fDaemonmruddy
2016-02-03Merge branch 'master' into single_prodnameLuke Dashjr
2016-02-03When/if the copyright line does not mention Bitcoin Core developers, add a ↵Luke Dashjr
second line to copyrights in -version, About dialog, and splash screen
2016-01-21move rpc* to rpc/Daniel Cousens
2015-12-14Unify package name to as few places as possible without major changesLuke Dashjr
2015-12-13Bump copyright headers to 2015MarcoFalke
2015-11-27Initialize logging before we do parameter interactionJonas Schnelli
2015-11-27Refactor parameter interaction, call it before AppInit2()Jonas Schnelli
2015-10-27constify missing catch casesPhilip Kaufmann
- ensure all missing catch cases are constant where possible