aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
AgeCommit message (Collapse)Author
2020-06-09refactor: Error message bilingual_str consistencyWladimir J. van der Laan
- Move the decision whether to translate an error message to where it is defined. This simplifies call sites: no more `InitError(Untranslated(...))`. - Make all functions in `util/error.h` consistently return a `bilingual_str`. We've decided to use this as error message type so let's roll with it. This has no functional changes: no messages are changed, no new translation messages are defined.
2020-06-08doc: Extract net permissions docMarcoFalke
2020-06-08Merge #19180: refactor: Replace RecursiveMutex with Mutex in Shutdown()MarcoFalke
1a9ef1d398dd14728b6bc67a89139cdf827c9753 refactor: Replace RecursiveMutex with Mutex in Shutdown() (Hennadii Stepanov) Pull request description: Step by step, going to replace all of the `RecursiveMutex` instances with the `Mutex` ones throughout the code base :) Not sure if it is possible in all cases though... This one is a low-hanging fruit. ACKs for top commit: MarcoFalke: ACK 1a9ef1d398dd14728b6bc67a89139cdf827c9753 Shutdown is not recursive, so the same thread can never lock twice (UB) vasild: ACK 1a9ef1d3 verified manually that `Shutdown()` is not called from places that could be called from inside `Shutdown()`. Tree-SHA512: 362a507b1a6f97dc351f708224aedbfe4bee03c4398f394d78ee31c24d76a7012ffff0e6766866cd5fd9a8e0d8840f05a2741111fe583aa20d45f0af3df0dcfa
2020-06-07Merge #19005: doc: Add documentation for 'checklevel' argument in ↵MarcoFalke
'verifychain' RPC… 501e6ab4e778d8f4e95fdc807eeb8644df16203b doc: Add documentation for 'checklevel' argument in 'verifychain' RPC call (Calvin Kim) Pull request description: Rationale: When ```bitcoin-cli help verifychain``` is called, the user doesn't get any documentation about the ```checklevel``` argument, leading to issues like #18995. This PR addresses that issue and adds documentation for what each level does, and that each level includes the checks of the previous levels. ACKs for top commit: jonatack: ACK 501e6ab4e778d8f4e95fdc807eeb8644df16203b `git diff 292ed3c 501e6ab` shows only change since last review is the verifychain RPCHelpMan edit; rebuild and retested manually anyway MarcoFalke: ACK 501e6ab4e778d8f4e95fdc807eeb8644df16203b 🚝 Tree-SHA512: 09239f79c25b5c3022b8eb1f76198ba681305d7e8775038e46becffe5f6a14c572e0c5d06b0723fe9d4a015ec42c9f7ca7b80a2a93df0b1b66f5a84a80eeeeb1
2020-06-07doc: Add documentation for 'checklevel' argument in 'verifychain' RPC callCalvin Kim
2020-06-06Merge #18968: doc: noban precludes maxuploadtarget disconnectsMarcoFalke
fa9604c46f3245a704487c29b684caadffbf73bc doc: noban precludes maxuploadtarget disconnects (MarcoFalke) fa3999fe351b510bb141dff9ae4ecc8e717bf292 net: Reformat excessively long if condition into multiple lines (MarcoFalke) Pull request description: Whitelisting has been replaced by permission flags, so properly document this. See also #10131 ACKs for top commit: hebasto: ACK fa9604c46f3245a704487c29b684caadffbf73bc, I have reviewed the code and it looks OK, I agree it can be merged. ariard: ACK fa9604c Tree-SHA512: 5aee917ab9817719f01ec155487542118e17fa3d145ae7e4bc0e872b2cec39cde9e7fbdee2ae77e9a52700dd8bcc366de4224152e08e709d44d08e0d2f19c613
2020-06-05refactor: Replace RecursiveMutex with Mutex in Shutdown()Hennadii Stepanov
2020-06-05Merge #18758: Remove unused boost/threadfanquake
89f9fef1f71dfeff4baa59bc42bc9049a46d911b refactor: Specify boost/thread/thread.hpp explicitly (Hennadii Stepanov) fad8c890f5ae6e083e416781b4857a1a53ad5249 txdb: Remove unused boost/thread (MarcoFalke) faa958bc283023334b9377f5fb2210459ca16d82 txindex: Remove unused boost/thread (MarcoFalke) Pull request description: There are predefined interruption points for `boost::thread`: https://www.boost.org/doc/libs/1_71_0/doc/html/thread/thread_management.html#interruption_points However, non-boost threads such as `std::thread` or the `main()` thread can obviously not be interrupted. So remove all unused boost/thread from methods that are never executed in a `boost::thread`. Most of them were accompanied by a `ShutdownRequested` anyway. So even if the current thread was a `boost::thread`, the interruption point would be redundant. (We only interrupt threads during shutdown) ACKs for top commit: fanquake: ACK 89f9fef1f71dfeff4baa59bc42bc9049a46d911b hebasto: ACK 89f9fef1f71dfeff4baa59bc42bc9049a46d911b, tested on Linux Mint 19.3 (x86_64), verified shutdown in different scenarios. Tree-SHA512: 17221dadedf2d107e5bda9e4f371cc4f8ffce6ad27cae41aa2b8f1150d8f1adf23d396585ca4a2dd25b1dc6f0d5c81fecd950d8557966ccb45a6d4a85a331d90
2020-06-04doc: noban precludes maxuploadtarget disconnectsMarcoFalke
2020-06-04refactor: Specify boost/thread/thread.hpp explicitlyHennadii Stepanov
2020-06-02refactor: Fix unreachable code in init arg checksJonathan Schoeller
Building with -Wunreachable-code-loop-increment causes a warning due to always returning on the first iteration of the loop that outputs errors on invalid args. Collect all errors, and output them in a single error message after the loop completes, resolving the warning and avoiding popup hell by outputting a seperate message for each error.
2020-05-21validation: Make LoadBlockIndex() a member of ChainstateManagerMarcoFalke
2020-05-21net: Pass chainman into PeerLogicValidationMarcoFalke
2020-05-21node: Add chainman alias for g_chainmanMarcoFalke
2020-05-21Merge #18740: Remove g_rpc_node globalMarcoFalke
b3f7f375efb9a9ca9a7a4f2caf41fe3df2262520 refactor: Remove g_rpc_node global (Russell Yanofsky) ccb5059ee89f6e8dc31ba5b82830b384890bb65e scripted-diff: Remove g_rpc_node references (Russell Yanofsky) 6fca33b2edc09ed62dab2323c780b31585de1750 refactor: Pass NodeContext to RPC and REST methods through util::Ref (Russell Yanofsky) 691c817b340d10e806dc3b1834d2a8fcc5e681fd Add util::Ref class as temporary alternative for c++17 std::any (Russell Yanofsky) Pull request description: This PR removes the `g_rpc_node` global, to get same benefits we see removing other globals and make RPC code more testable, modular, and reusable. This uses a hybrid of the approaches suggested in #17548. Instead of using `std::any`, which isn't available in c++11, or `void*`, which isn't type safe, it uses a small new `util::Ref` helper class, which acts like a simplified `std::any` that only holds references, not values. Motivation for writing this was to provide an simpler alternative to #18647 by Harris Brakmić (brakmic) which avoids some shortcomings of that PR (https://github.com/bitcoin/bitcoin/pull/18647#issuecomment-617878826) ACKs for top commit: MarcoFalke: re-ACK b3f7f375ef, only change is adding back const and more tests 🚾 ajtowns: ACK b3f7f375efb9a9ca9a7a4f2caf41fe3df2262520 Tree-SHA512: 56292268a001bdbe34d641db1180c215351503966ff451e55cc96c9137f1d262225d7d7733de9c9da7ce7d7a4b34213a98c2476266b58c89dbbb0f3cb5aa5d70
2020-05-19refactor: Pass SynchronizationState enum to GUIHennadii Stepanov
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
2020-05-19refactor: Remove unused bool parameter in RPCNotifyBlockChange()Hennadii Stepanov
2020-05-19refactor: Remove unused bool parameter in BlockNotifyGenesisWait()Hennadii Stepanov
2020-05-13refactor: Remove g_rpc_node globalRussell Yanofsky
This commit does not change behavior
2020-05-13refactor: Pass NodeContext to RPC and REST methods through util::RefRussell Yanofsky
This commit does not change behavior
2020-05-13Merge #18922: gui: Do not translate InitWarning messages in debug.logJonas Schnelli
78be8d97d3d750fcfbbe509a72639b7b30b7bd18 util: Drop OpOriginal() and OpTranslated() (Hennadii Stepanov) da16f95c3fecf4ee1e9a1dc4333b0b92cd981afd gui: Do not translate InitWarning messages in debug.log (Hennadii Stepanov) 4c9b9a4882e68835f16a52f1f0657efe47e589b5 util: Enhance Join() (Hennadii Stepanov) fe05dd0611cfc2929a7fdec04ca5948bccf0233b util: Enhance bilingual_str (Hennadii Stepanov) Pull request description: This PR forces the `bitcoin-qt` to write `InitWarning()` messages to the `debug.log` file in untranslated form, i.e., in English. On master (376294cde6b1588cb17055d8fde567eaf5848c3c): ``` $ ./src/qt/bitcoin-qt -lang=nl -debug=vladidation -printtoconsole | grep 'vladi' Warning: Niet-ondersteunde logcategorie -debug=vladidation. 2020-05-09T12:39:59Z Warning: Niet-ondersteunde logcategorie -debug=vladidation. 2020-05-09T12:40:02Z Command-line arg: debug="vladidation" ``` With this PR: ``` $ ./src/qt/bitcoin-qt -lang=nl -debug=vladidation -printtoconsole | grep 'vladi' Warning: Unsupported logging category -debug=vladidation. 2020-05-09T12:42:04Z Warning: Unsupported logging category -debug=vladidation. 2020-05-09T12:42:35Z Command-line arg: debug="vladidation" ``` ![Screenshot from 2020-05-09 15-42-31](https://user-images.githubusercontent.com/32963518/81474073-c7a50e00-920b-11ea-8775-c41122dacafe.png) Related to #16218. ACKs for top commit: laanwj: ACK 78be8d97d3d750fcfbbe509a72639b7b30b7bd18 jonasschnelli: utACK 78be8d97d3d750fcfbbe509a72639b7b30b7bd18 MarcoFalke: ACK 78be8d97d3d750fcfbbe509a72639b7b30b7bd18 📢 Tree-SHA512: 48e9ecd23c4dd8ec262e3eb94f8e30944bcc9c6c163245fb837b2e0c484d4d0b4f47f7abc638c14edc27d635d340ba3ee4ba4506b062399e9cf59a1564c98755
2020-05-12Merge #18910: p2p: add MAX_FEELER_CONNECTIONS constantfanquake
e3047edfb63c3d098cb56ba9f9a1e7e0a795d552 test: use p2p constants in denial of service tests (fanquake) 25d8264c95eaf98a66df32addb0bf32d795a35bd p2p: add MAX_FEELER_CONNECTIONS constant (tryphe) Pull request description: Extracted from #16003. ACKs for top commit: naumenkogs: utACK e3047ed Tree-SHA512: 14fc15292be4db2e825a0331dd189a48713464f622a91c589122c1a7135bcfd37a61e64af1e76d32880ded09c24efd54d3c823467d6c35367a380e0be33bd35f
2020-05-12p2p: add MAX_FEELER_CONNECTIONS constanttryphe
2020-05-10gui: Do not translate InitWarning messages in debug.logHennadii Stepanov
2020-05-08[init] Add -peerblockfilters optionJim Posen
When a node is configured with --blockfilterindex=basic and -peerblockfilters it can serve compact block filters to its peers. This commit adds the configuration option handling. Future commits add compact block serving and service bits signaling.
2020-05-05Make InitError bilingualHennadii Stepanov
2020-05-05Make ThreadSafe{MessageBox|Question} bilingualHennadii Stepanov
2020-04-27init: Remove boost from ThreadImportMarcoFalke
2020-04-26Merge #18669: log: Use Join() helper when listing log categoriesMarcoFalke
faec0638872798b58b9882ee079014555bc8393e log: Use Join() helper when listing log categories (MarcoFalke) Pull request description: This removes the global `ListLogCategories` and replaces it with a one-line member function `LogCategoriesString`, which just calls `Join`. Should be a straightforward refactor to get rid of a few LOC. ACKs for top commit: laanwj: ACK faec0638872798b58b9882ee079014555bc8393e promag: ACK faec0638872798b58b9882ee079014555bc8393e, I also think it's fine as it is (re https://github.com/bitcoin/bitcoin/pull/18669#discussion_r412944724). Tree-SHA512: 2f51f9ce1246eda5630015f3a869e36953c7eb34f311baad576b92d7829e4e88051c6189436271cd0a13732a49698506345b446b98fd28e58edfb5b62169f1c9
2020-04-20Do not expose and consider -logthreadnames when it does not workHennadii Stepanov
2020-04-16log: Use Join() helper when listing log categoriesMarcoFalke
2020-04-15node: Add args alias for gArgs globalMarcoFalke
2020-04-10Merge #17737: Add ChainstateManager, remove BlockManager globalMarcoFalke
c9017ce3bc27665594c9d80f395780d40755bb22 protect g_chainman with cs_main (James O'Beirne) 2b081c4568e8019886fdb0f2a57babc73d7487f7 test: add basic tests for ChainstateManager (James O'Beirne) 4ae29f5f0c5117032debb722d7049664fdceeae8 use ChainstateManager to initialize chainstate (James O'Beirne) 5b690f0aae21e7d46cbefe3f5be645842ac4ae3b refactor: move RewindBlockIndex to CChainState (James O'Beirne) 89cdf4d5692d396b8c7177b3918aa9dab07f9624 validation: introduce unused ChainstateManager (James O'Beirne) 8e2ecfe2496d8a015f3ee8723025a438feffbd28 validation: add CChainState.m_from_snapshot_blockhash (James O'Beirne) Pull request description: This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11): Parent PR: #15606 Issue: #15605 Specification: https://github.com/jamesob/assumeutxo-docs/tree/master/proposal --- This changeset introduces `ChainstateManager`, which is responsible for creating and managing access to multiple chainstates. Until we allow chainstate creation from UTXO snapshots (next assumeutxo PR?) it's basically unnecessary, but it is a prerequisite for background IBD support. Changes are also made to the initialization process to make use of `g_chainman` and thus clear the way for multiple chainstates being loaded on startup. One immediate benefit of this change is that we no longer have the `g_blockman` global, but instead have the ChainstateManager inject a reference of its shared BlockManager into any chainstate it creates. Another immediate benefit is that uses of `ChainActive()` and `ChainstateActive()` are now covered by lock annotations. Because use of `g_chainman` is annotated to require cs_main, these two functions subsequently follow. Because of whitespace changes, this diff looks bigger than it is. E.g., 4813167d98 is most easily reviewed with ```sh git show --color-moved=dimmed_zebra -w 4813167d98 ``` ACKs for top commit: MarcoFalke: re-ACK c9017ce3bc27665594c9d80f395780d40755bb22 📙 fjahr: Code Review Re-ACK c9017ce3bc27665594c9d80f395780d40755bb22 ariard: Code Review ACK c9017ce ryanofsky: Code review ACK c9017ce3bc27665594c9d80f395780d40755bb22. No changes since last review other than a straight rebase Tree-SHA512: 3f250d0dc95d4bfd70852ef1e39e081a4a9b71a4453f276e6d474c2ae06ad6ae6a32b4173084fe499e1e9af72dd9007f4a8a375c63ce9ac472ffeaada41ab508
2020-04-10Merge #18526: Remove PID file at the very endMarcoFalke
7fcdec0f326f7fb547ec9c651871842cf518ea38 Remove PID file at the very end (Hennadii Stepanov) Pull request description: While reproducing the bug from #18517, I've noticed that the `bitcoind.pid` file has already been removed when the `bitcoind` hangs. This PR makes `Shutdown()` keep the `bitcoind.pid` file available until the end. ACKs for top commit: MarcoFalke: ACK 7fcdec0f326f7fb547ec9c651871842cf518ea38 emilengler: utACK 7fcdec0f326f7fb547ec9c651871842cf518ea38 promag: Code review ACK 7fcdec0f326f7fb547ec9c651871842cf518ea38. theStack: Code review ACK 7fcdec0f326f7fb547ec9c651871842cf518ea38 Tree-SHA512: 9732ef34e137dbee70a06d922b316b8ea7b9a1c959cf8861b6940cd789336dc19ee468a4c3a28d95d1458076a48270c676b0ff27fec30cf57eced6ddab0a2a9b
2020-04-06Merge #18458: net: Add missing cs_vNodes lockWladimir J. van der Laan
fa369651c5523f393e0bfcfa328b8e27006711aa net: Add missing cs_vNodes lock (MarcoFalke) Pull request description: Fixes #18457 ACKs for top commit: promag: Code review ACK fa369651c5523f393e0bfcfa328b8e27006711aa. laanwj: ACK fa369651c5523f393e0bfcfa328b8e27006711aa Tree-SHA512: 60d7000f2f3d480bb0953ce27a0020763e7102da16a0006b619e0a236cfc33cbd4f83d870e9f0546639711cd877c1f9808d419184bbc153bb328885417e0066c
2020-04-06Remove PID file at the very endHennadii Stepanov
2020-04-02init: Replace URL_WEBSITE with PACKAGE_URLMarcoFalke
2020-03-29net: Add missing cs_vNodes lockMarcoFalke
2020-03-29Merge #18391: doc: Update init and reduce-traffic docs for -blocksonlyMarcoFalke
621e86ee8d0102e2bf41f7656a368083b89b2f83 Update -blocksonly documentation (glowang) Pull request description: When -blocksonly is set to 1, it interacts with the -walletbroadcast parameter and sets it to 0. This behavior is not captured by the current documentation, which claims that -blocksonly does not impact any wallet transactions at all. Fixes #17294 ACKs for top commit: MarcoFalke: ACK 621e86ee8d0102e2bf41f7656a368083b89b2f83 Tree-SHA512: f47bfb40a196c23e62505e1d4f79094011ac7c21fc9b920fad60cdadb5c4f48e993be1f015e26e568ce329967c24848fd7b665a6cffd3881f4cfcd2fd0081ed8
2020-03-29Update -blocksonly documentationglowang
When -blocksonly is set to 1, it interacts with the -walletbroadcast parameter and sets it to 0 if it has not been set already.This behavior is not captured by the current documentation, which claims that -blocksonly does not impact any wallet transactions. Update the max number of outgoing peers from 8 to 10, due to the addition of two -blocksonly peers.
2020-03-19Merge #17477: Remove the mempool's NotifyEntryAdded and NotifyEntryRemoved ↵Wladimir J. van der Laan
signals e57980b4738c10344baf136de3e050a3cb958ca5 [mempool] Remove NotifyEntryAdded and NotifyEntryRemoved callbacks (John Newbery) 2dd561f36124972d2364f941de9c3417c65f05b6 [validation] Remove pool member from ConnectTrace (John Newbery) 969b65f3f527631ede1a31c7855151e5c5d91f8f [validation] Remove NotifyEntryRemoved callback from ConnectTrace (John Newbery) 5613f9842b4000fed088b8cf7b99674c328d15e1 [validation] Remove conflictedTxs from PerBlockConnectTrace (John Newbery) cdb893443cc16edf974f099b8485e04b3db1b1d7 [validation interface] Remove vtxConflicted from BlockConnected (John Newbery) 1168394d759b13af68acec6d5bfa04aaa24561f8 [wallet] Notify conflicted transactions in TransactionRemovedFromMempool (John Newbery) Pull request description: These boost signals were added in #9371, before we had a `TransactionRemovedFromMempool` method in the validation interface. The `NotifyEntryAdded` callback was used by validation to build a vector of conflicted transactions when connecting a block, which the wallet was notified of in the `BlockConnected` CValidationInterface callback. Now that we have a `TransactionRemovedFromMempool` callback, we can fire that signal directly from the mempool for conflicted transactions. Note that #9371 was implemented to ensure `-walletnotify` events were fired for these conflicted transaction. We inadvertently stopped sending these notifications in #16624 (Sep 2019 commit 7e89994). We should probably fix that, but in a different PR. ACKs for top commit: jonatack: Re-ACK e57980b ryanofsky: Code review ACK e57980b4738c10344baf136de3e050a3cb958ca5, no code changes since previous review, but helpful new code comments have been added and the PR description is now more clear about where the old code came from Tree-SHA512: 3bdbaf1ef2731e788462d4756e69c42a1efdcf168691ce1bbfdaa4b7b55ac3c5b1fd4ab7b90bcdec653703600501b4224d252cfc086aef28f9ce0da3b0563a69
2020-03-17Merge #18289: refactor: Make scheduler methods type safeMarcoFalke
fa36f3a29538012a6eb5c3402b3b3c18fd32b230 refactor: move DUMP_BANS_INTERVAL to banman.h (MarcoFalke) fadafb83cff9a9a340eac1b5a853e2467d5e0ef7 scheduler: Make schedule* methods type safe (MarcoFalke) fa70ccc6c4e304646b4610228f3975b3a9762643 scheduler: Use C++11 member initialization, add shutdown assert (MarcoFalke) Pull request description: Main benefit is that stuff like `15 * 60 * 1000` is replaced by `minutes{15}` ACKs for top commit: vasild: ACK fa36f3a (code review, not tested) ajtowns: ACK fa36f3a29538012a6eb5c3402b3b3c18fd32b230 jonatack: ACK fa36f3a Tree-SHA512: f35f1a1d643dfa676bd47474659f6492ed05cca04cdb556064b126f654a6a44a4b93fcaddcdcd41faf81b8f11439c11e5c7ab88685ba2eef12f7188843d17ad8
2020-03-17protect g_chainman with cs_mainJames O'Beirne
I'd previously attempted to create a specialized lock for ChainstateManager, but it turns out that because that lock would be required for functions like ChainActive() and ChainstateActive(), it created irreconcilable lock inversions since those functions are used so broadly throughout the codebase. Instead, I'm just using cs_main to protect the contents of g_chainman. Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
2020-03-17use ChainstateManager to initialize chainstateJames O'Beirne
This allows us to easily initialize multiple chainstates on startup in future commits. It retires the g_chainstate global in lieu of g_chainman.
2020-03-17refactor: move RewindBlockIndex to CChainStateJames O'Beirne
This is in preparation for multiple chainstate initialization in init.
2020-03-12refactor: Remove mempool global from netMarcoFalke
This refactor does two things: * Pass mempool in to PeerLogicValidation * Pass m_mempool around where needed
2020-03-11[mempool] Remove NotifyEntryAdded and NotifyEntryRemoved callbacksJohn Newbery
NotifyEntryAdded never had any subscribers so can be removed. Since ConnectTrace no longer subscribes to NotifyEntryRemoved, there are now no subscribers. The CValidationInterface TransactionAddedToMempool and TransactionRemovedFromMempool methods can now provide this functionality. There's no need for a special notifications framework for the mempool.
2020-03-10refactor: move DUMP_BANS_INTERVAL to banman.hMarcoFalke
2020-03-10scheduler: Make schedule* methods type safeMarcoFalke
2020-03-06scheduler: don't rely on boost interrupt on shutdownAnthony Towns
Calling interrupt_all() will immediately stop the scheduler, so it's safe to invoke stop() beforehand, and this removes the reliance on boost to interrupt serviceQueue().