aboutsummaryrefslogtreecommitdiff
path: root/src/util/system.h
AgeCommit message (Collapse)Author
2021-05-24Remove `GetDataDir(bool fNetSpecific = true)` functionKiminuo
2021-05-24Make `ArgsManager.GetDataDirPath` private and drop needless suffixKiminuo
2021-05-24Add `ArgsManager.GetDataDirBase()` and `ArgsManager.GetDataDirNet()` as an ↵Kiminuo
intended replacement for `ArgsManager.GetDataDirPath(net_identifier)`
2021-05-22Make `m_cached_blocks_path` mutable. Make `ArgsManager::GetBlocksDirPath()` ↵Kiminuo
const.
2021-05-12Merge bitcoin/bitcoin#19064: refactor: Cleanup thread ctor callsMarcoFalke
792be53d3e9e366b9f6aeee7a1eeb912fa28062e refactor: Replace std::bind with lambdas (Hennadii Stepanov) a508f718f3e087c96a306399582a85df2e1d53ae refactor: Use appropriate thread constructor (Hennadii Stepanov) 30e44482152488a78f2c495798a75e6f553dc0c8 refactor: Make TraceThread a non-template free function (Hennadii Stepanov) Pull request description: This PR does not change behavior. Its goal is to improve readability and maintainability of the code. ACKs for top commit: jnewbery: utACK 792be53d3e9e366b9f6aeee7a1eeb912fa28062e jonatack: tACK 792be53d3e9e366b9f6aeee7a1eeb912fa28062e MarcoFalke: cr ACK 792be53d3e9e366b9f6aeee7a1eeb912fa28062e Tree-SHA512: a03142f04f370f6bc02bd3ddfa870819b51740fcd028772241d68c84087f95a2d78207cbd5edb3f7c636fcf2d76192d9c59873f8f0af451d3b05c0cf9cf234df
2021-04-25refactor: Make TraceThread a non-template free functionHennadii Stepanov
Also it is moved into its own module.
2021-04-18Change ClearDataDirPathCache() to ArgsManager.ClearPathCache().Kiminuo
2021-04-18Change GetBlocksDir() to ArgsManager.GetBlocksDirPath().Kiminuo
2021-04-17Move GetDataDir(fNetSpecific) implementation to ArgsManager.Kiminuo
2021-03-29util: introduce helper AnyPtr to access std::any instancesSebastian Falbesoner
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
2021-03-17refactor: post Optional<> removal cleanupsfanquake
2021-03-15scripted-diff: remove Optional & nulloptfanquake
-BEGIN VERIFY SCRIPT- git rm src/optional.h sed -i -e 's/Optional</std::optional</g' $(git grep -l 'Optional<' src) sed -i -e 's/{nullopt}/{std::nullopt}/g' $(git grep -l 'nullopt' src) sed -i -e 's/ nullopt;/ std::nullopt;/g' $(git grep -l 'nullopt' src) sed -i -e 's/ nullopt)/ std::nullopt)/g' $(git grep -l 'nullopt' src) sed -i -e 's/(nullopt)/(std::nullopt)/g' $(git grep -l 'nullopt' src) sed -i -e 's/ nullopt,/ std::nullopt,/g' $(git grep -l 'nullopt' src) sed -i -e 's/? nullopt :/? std::nullopt :/g' $(git grep -l 'nullopt' src) sed -i -e 's/: nullopt}/: std::nullopt}/g' $(git grep -l 'nullopt' src) sed -i -e '/optional.h \\/d' src/Makefile.am sed -i -e '/#include <optional.h>/d' src/test/fuzz/autofile.cpp src/test/fuzz/buffered_file.cpp src/test/fuzz/node_eviction.cpp sed -i -e 's/#include <optional.h>/#include <optional>/g' $(git grep -l '#include <optional.h>' src) -END VERIFY SCRIPT-
2021-03-11scripted-diff: remove MakeUnique<T>()fanquake
-BEGIN VERIFY SCRIPT- git rm src/util/memory.h sed -i -e 's/MakeUnique/std::make_unique/g' $(git grep -l MakeUnique src) sed -i -e '/#include <util\/memory.h>/d' $(git grep -l '#include <util/memory.h>' src) sed -i -e '/util\/memory.h \\/d' src/Makefile.am -END VERIFY SCRIPT-
2021-02-21configure: add --enable-external-signerSjors Provoost
This option replaces --with-boost-process This prepares external signer support to be disabled by default. It adds a configure option to enable this feature and to check if Boost::Process is present. This also exposes ENABLE_EXTERNAL_SIGNER to the test suite via test/config.ini
2021-02-04refactor: Treat ArgsManager::Flags as uint32_t explicitlyMarcoFalke
2021-02-04Merge #20715: util: Add ArgsManager::GetCommand() and use it in bitcoin-walletMarcoFalke
fa61b9d1a68820758f9540653920deaeae6abe79 util: Add ArgsManager::GetCommand() and use it in bitcoin-wallet (MarcoFalke) 7777105a24a36b62df35d12ecf6c6370671568c8 refactor: Move all command dependend checks to ExecuteWalletToolFunc (MarcoFalke) fa06bce4ac17f93decd4ee38c956e7aa55983f0d test: Add tests (MarcoFalke) fac05ccdade8b34c969b9cd9b37b355bc0aabf9c wallet: [refactor] Pass ArgsManager to WalletAppInit (MarcoFalke) Pull request description: This not only moves the parsing responsibility out from the wallet tool, but it also makes it easier to implement bitcoin-util #19937 Fixes: #20902 ACKs for top commit: ajtowns: ACK fa61b9d1a68820758f9540653920deaeae6abe79 fjahr: Code review ACK fa61b9d1a68820758f9540653920deaeae6abe79 Tree-SHA512: 79622b806e8bf9dcd0dc24a8a6687345710df57720992e83a41cd8d6762a6dc112044ebc58fcf6e8fbf45de29a79b04873c5b8c2494a1eaaf902a2884703e47b
2021-01-29refactor: remove boost::thread_group usagefanquake
2021-01-21util: Add ArgsManager::GetCommand() and use it in bitcoin-walletMarcoFalke
Co-Authored-by: Anthony Towns <aj@erisian.com.au>
2021-01-07Merge #14501: Fix possible data race when committing block filesWladimir J. van der Laan
ef712298c3f8bc2afdad783f05080443b72b3f77 util: Check for file being NULL in DirectoryCommit (Luke Dashjr) 457490403853321d308c6ca6aaa90d6f8f29b4cf Fix possible data race when committing block files (Evan Klitzke) 220bb16cbee5b91d0bc0fcc6c71560d631295fa5 util: Introduce DirectoryCommit commit function to sync a directory (Evan Klitzke) ce5cbaea63ad4ea78e533bdb14f47f414061ae7f util.h: Document FileCommit function (Evan Klitzke) 844d650eea3bd809884cc5dd996a388bdc58314e util: Prefer Mac-specific F_FULLSYNC over fdatasync in FileCommit (Evan Klitzke) f6cec0bcaf560fa310853ad3fe17022602b63d5f util: Refactor FileCommit from an #if sequence nested in #else, to a sequence of #elif (Evan Klitzke) Pull request description: Reviving #12696 ACKs for top commit: laanwj: Code review ACK ef712298c3f8bc2afdad783f05080443b72b3f77 Tree-SHA512: 07d650990ef4c18d645dee3f9a199a940683ad17557d79d93979a76c4e710d8d70e6eae01d1a5991494a24a7654eb7db868be0c34a31e70b2509945d95bc9cce
2020-12-01Merge #20519: Handle rename failure in DumpMempool(...) by using the ↵MarcoFalke
RenameOver(...) return value. Add [[nodiscard]] to RenameOver(...). ce9dd45422e1f4ecce6df68da086b8bfc2100756 Add [[nodiscard]] to RenameOver(...) (practicalswift) 9429a398e291a1b5edcfc657b94fcaf52cd1d8f9 Handle rename failure in DumpMempool(...) by using RenameOver(...) return value (practicalswift) Pull request description: Handle rename failure in `DumpMempool(...)` by using the `RenameOver(...)` return value. Add `[[nodiscard]]` to `RenameOver(...)` to reduce the risk of similar rename issues in the future. ACKs for top commit: vasild: ACK ce9dd454 theStack: ACK ce9dd45422e1f4ecce6df68da086b8bfc2100756 🏷️ Tree-SHA512: 1e63d7f3061e1f6ea2df5750dbc1547a39bd50b6c529812a0c8a0c11d3100c241afdf14094e69b69a38bade7e54a12b2a42888545874398eaf5d02421b57e874
2020-11-27Add [[nodiscard]] to RenameOver(...)practicalswift
2020-11-26scripted-diff: Use [[nodiscard]] (C++17) instead of NODISCARDpracticalswift
-BEGIN VERIFY SCRIPT- sed -i "s/NODISCARD/[[nodiscard]]/g" $(git grep -l "NODISCARD" ":(exclude)src/bench/nanobench.h" ":(exclude)src/attributes.h") -END VERIFY SCRIPT-
2020-08-25util: Introduce DirectoryCommit commit function to sync a directoryEvan Klitzke
2020-08-25util.h: Document FileCommit functionEvan Klitzke
2020-07-31[util] add RunCommandParseJSONSjors Provoost
2020-07-11Add <datadir>/settings.json persistent settings storage.Russell Yanofsky
Persistent settings are used in followup PRs #15936 to unify gui settings between bitcoin-qt and bitcoind, and #15937 to add a load_on_startup flag to the loadwallet RPC and maintain a dynamic list of wallets that should be loaded on startup that also can be shared between bitcoind and bitcoin-qt.
2020-04-23Merge #17509: gui: save and load PSBTSamuel Dobson
764bfe4cba35c24f7627cc425d9e7eba56e98964 [psbt] add file size limit (Sjors Provoost) 1cd8dc2556b847e11a238b9e69493cd8fbeecc6c [gui] load PSBT (Sjors Provoost) f6895301f768220f3ea70231d5cc5b45ecbf4488 [gui] save PSBT to file (Sjors Provoost) 1d05a9d80b1211b47af465ba6958b0ec5a8c33ab Move DEFAULT_MAX_RAW_TX_FEE_RATE to node/transaction.h (Sjors Provoost) 86e22d23bb90383971a68ead0666f225ddd632fb [util] GetFileSize (Sjors Provoost) 6ab3aad9a51cc5e97a8e2ae7dbd5082272163c30 [gui] send dialog: split on_sendButton_clicked (Sjors Provoost) Pull request description: This adds: * a dialog after Create Unsigned, which lets you save a PSBT file in binary format, e.g. to an SD card * a "Load PSBT" menu entry lets you pick a PSBT file. We broadcast the transaction if complete ## Save flow <img width="482" alt="Schermafbeelding 2020-01-04 om 20 39 34" src="https://user-images.githubusercontent.com/10217/71765684-ba60d580-2f32-11ea-8dea-0c4398eb6e15.png"> <img width="287" alt="Schermafbeelding 2020-01-04 om 20 40 35" src="https://user-images.githubusercontent.com/10217/71765677-a0bf8e00-2f32-11ea-8172-12dfd34a89f3.png"> <img width="594" alt="Schermafbeelding 2020-01-04 om 20 41 12" src="https://user-images.githubusercontent.com/10217/71765681-aa48f600-2f32-11ea-8e2c-c4f6bf9f5309.png"> <img width="632" alt="Schermafbeelding 2020-01-04 om 20 41 28" src="https://user-images.githubusercontent.com/10217/71765691-d19fc300-2f32-11ea-97ff-70f5dd59987a.png"> By default the file name contains the destination address(es) and amount(s). We only use the binary format for files, in order to avoid compatibility hell. If we do want to add base64 file format support, we should use a different extension for that (`.psbt64`?). ## Load flow Select a file: <img width="649" alt="Schermafbeelding 2020-01-04 om 21 08 57" src="https://user-images.githubusercontent.com/10217/71766089-2ba28780-2f37-11ea-875d-074794b5707d.png"> Offer to send if complete: <img width="308" alt="Schermafbeelding 2020-01-04 om 21 09 06" src="https://user-images.githubusercontent.com/10217/71766088-2a715a80-2f37-11ea-807d-394c8b840c59.png"> Tell user if signatures are missing, offer to copy to clipboard: <img width="308" alt="Schermafbeelding 2020-01-04 om 21 15 57" src="https://user-images.githubusercontent.com/10217/71766115-702e2300-2f37-11ea-9f62-a6ede499c0fa.png"> Incomplete for another reason: <img width="309" alt="Schermafbeelding 2020-01-04 om 21 07 51" src="https://user-images.githubusercontent.com/10217/71766090-2c3b1e00-2f37-11ea-8a22-6188377b67a1.png"> ACKs for top commit: instagibbs: re-ACK https://github.com/bitcoin/bitcoin/pull/17509/commits/764bfe4cba35c24f7627cc425d9e7eba56e98964 achow101: ACK 764bfe4cba35c24f7627cc425d9e7eba56e98964 jb55: Tested ACK 764bfe4cba35c24f7627cc425d9e7eba56e98964 jonatack: ACK 764bfe4c promag: Code review ACK 764bfe4cba35c24f7627cc425d9e7eba56e98964. Tree-SHA512: d284ed6895f3a271fb8ff879aac388ad217ddc13f72074725608e1c3d6d90650f6dc9e9e254479544dd71fc111516b02c8ff92158153208dc40fb2726b37d063
2020-04-16util: Document why ArgsManager (con/de)structor is not inlineMarcoFalke
2020-03-24[util] GetFileSizeSjors Provoost
2020-02-17Merge #13339: wallet: Replace %w by wallet name in -walletnotify scriptWladimir J. van der Laan
4e9efac678a9c0ea4e4c7dd956ea036ae6cf17ec test: Check wallet name in -walletnotify script (João Barbosa) 9a5b5ee81f15b1d89cb25ff3e137a672536cdc46 wallet: Replace %w by wallet name in -walletnotify script (João Barbosa) Pull request description: Fixes #13237. ACKs for top commit: laanwj: ACK 4e9efac678a9c0ea4e4c7dd956ea036ae6cf17ec Tree-SHA512: 189dd1c785485f2e974d7c12531851b2a977778b3b954aa95efd527322ba3345924cfd587fb9c90b0fa979202af0ab2d90e53d125fe266a36c94f757e4176203
2020-01-29on startup, write config options to debug.logLarry Ruane
2020-01-15wallet: Replace %w by wallet name in -walletnotify scriptJoão Barbosa
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
2020-01-15scripted-diff: Bump copyright of files changed in 2020MarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2020-01-15scripted-diff: Replace CCriticalSection with RecursiveMutexMarcoFalke
-BEGIN VERIFY SCRIPT- # Delete outdated alias for RecursiveMutex sed -i -e '/CCriticalSection/d' ./src/sync.h # Replace use of outdated alias with RecursiveMutex sed -i -e 's/CCriticalSection/RecursiveMutex/g' $(git grep -l CCriticalSection) -END VERIFY SCRIPT-
2019-12-20Merge #17473: refactor: Settings code cleanupsMarcoFalke
e9fd366044e271632dc0e4f96e1c14f8e87213ae refactor: Remove null setting check in GetSetting() (Russell Yanofsky) cba2710220d76bbe790b04088839cbbd410436de scripted-diff: Remove unused ArgsManager type flags in tests (Russell Yanofsky) 425bb307252cf4dec9b3ef6426e6548b2be7a303 refactor: Add util_CheckValue test (Russell Yanofsky) 0fa54358b06b58f4d17073bcc8a959eb9498aadc refactor: Add ArgsManager::GetSettingsList method (Russell Yanofsky) 3e185522ace1678e0a25b9cf8a5553a4bc279bea refactor: Get rid of ArgsManagerHelper class (Russell Yanofsky) dc0f1480746b34aa3ca2d9c0f1ec764083026b40 refactor: Replace FlagsOfKnownArg with GetArgFlags (Russell Yanofsky) 57e8b7a7273567aa4a4aee87cce18e9bff8f3196 refactor: Clean up includeconf comments (Russell Yanofsky) 3f7dc9b808316c1e5d677af8d9a99112568c8ccb refactor: Clean up long lines in settings code (Russell Yanofsky) Pull request description: This PR doesn't change behavior. It just implements some suggestions from #15934 and #16545 and few other small cleanups. ACKs for top commit: jnewbery: Code review ACK e9fd366044e271632dc0e4f96e1c14f8e87213ae MarcoFalke: ACK e9fd366044 🚟 Tree-SHA512: 6e100d92c72f72bc39567187ab97a3547b3c06e5fcf1a1b74023358b8bca552124ca6a53c0ab53179b7f1329c03d9a73faaef6d73d2cd1a2321568a0286525e2
2019-11-26util: make ScheduleBatchPriority advisory onlyfanquake
2019-11-13refactor: Add ArgsManager::GetSettingsList methodRussell Yanofsky
Add for consistency with ArgsManager::GetSetting method and to make setting types accessible to ArgsManager callers and tests (test added next commit). This commit does not change behavior.
2019-11-13refactor: Get rid of ArgsManagerHelper classRussell Yanofsky
Suggested by John Newbery <john@johnnewbery.com> https://github.com/bitcoin/bitcoin/pull/15934#issuecomment-551969778 This commit does not change behavior.
2019-11-13refactor: Replace FlagsOfKnownArg with GetArgFlagsRussell Yanofsky
Rename suggested by João Barbosa <joao.paulo.barbosa@gmail.com> https://github.com/bitcoin/bitcoin/pull/16545#issuecomment-519048000 This also gets rid of ArgsManager::NONE constant, which was an implementation detail not meant to be used by ArgsManager callers. Finally this reverts a change from 7f40528cd50fc43ac0bd3e785de24d661adddb7a https://github.com/bitcoin/bitcoin/pull/15934 adding "-" characters to argument names. Better for GetArgFlags to require "-" prefixes for consistency with other ArgsManager methods, and to be more efficient later when GetArg functions need to call GetArgFlags (https://github.com/bitcoin/bitcoin/pull/16545) This commit does not change behavior.
2019-11-07Deduplicate settings merge codeRussell Yanofsky
Get rid of settings merging code in util/system.cpp repeated 5 places, inconsistently: - ArgsManagerHelper::GetArg - ArgsManagerHelper::GetNetBoolArg - ArgsManager::GetArgs - ArgsManager::IsArgNegated - ArgsManager::GetUnsuitableSectionOnlyArgs Having settings merging code separated from parsing simplifies parsing somewhat (for example negated values can simply be represented as false values instead of partially cleared or emply placeholder lists). Having settings merge happen one place instead of 5 makes it easier to add new settings sources and harder to introduce new inconsistencies in the way settings are merged. This commit does not change behavior in any way.
2019-11-01doc: Remove explicit network name referencesFabian Jahr
2019-08-19Merge #15864: Fix datadir handlingMarcoFalke
ffea41f5301d5582665cf10ba5c2b9547a1443de Enable all tests in feature_config_args.py (Hennadii Stepanov) 66f5c17f8a3fe06fc65191e379ffc04e43cbbc86 Use CheckDataDirOption() for code uniformity (Hennadii Stepanov) 7e33a18a34b1a9b0f115076c142661d6d30c0585 Fix datadir handling in bitcoin-cli (Hennadii Stepanov) b28dada37465c0a773cf08b0e6766f0081bcb943 Fix datadir handling in bitcoin-qt (Hennadii Stepanov) 50824093bb2d68fe1393dfd636fab5f8795faa5d Fix datadir handling in bitcoind (Hennadii Stepanov) 740d41ce9f7fdf209366e930bd0fdcc6b1bc6b79 Add CheckDataDirOption() function (Hennadii Stepanov) c1f325126cf51d28dce8da74bfdf5cd05ab237ea Return absolute path early in AbsPathForConfigVal (Hennadii Stepanov) Pull request description: Fix #15240, see: https://github.com/bitcoin/bitcoin/issues/15240#issuecomment-487353760 Fix #15745 Fix broken `feature_config_args.py` tests (disabled by MarcoFalke@fabe28a0cdcfa13e0e595a0905e3642a960d3077). All test are enabled now. This PR is alternative to #13621. User's `$HOME` directory is not touched unnecessarily now. ~To make reviewing easier only `bitcoind` code is modified (neither `bitcoin-cli` nor `bitcoin-qt`).~ Refs: - https://github.com/bitcoin/bitcoin/issues/15745#issuecomment-479852569 by **laanwj** - #16220 Top commit has no ACKs. Tree-SHA512: 4a4cda10e0b67c8f374da0c9567003d2b566d948e7f8550fe246868b5794c15010e88ea206009480b9cd2f737f310a15e984f920730448f99a895893bed351df
2019-07-27Replace IsArgKnown() with FlagsOfKnownArg()Hennadii Stepanov
2019-07-27Use ArgsManager::NETWORK_ONLY flagHennadii Stepanov
2019-07-27Remove unused m_debug_only member from Arg structHennadii Stepanov
2019-07-27scripted-diff: Use ArgsManager::DEBUG_ONLY flagHennadii Stepanov
-BEGIN VERIFY SCRIPT- sed -i 's/unsigned int flags, const bool debug_only,/unsigned int flags,/' src/util/system.h src/util/system.cpp sed -i 's/ArgsManager::NONE, debug_only/flags, false/' src/util/system.cpp sed -i 's/arg.second.m_debug_only/(arg.second.m_flags \& ArgsManager::DEBUG_ONLY)/' src/util/system.cpp sed -i 's/ArgsManager::ALLOW_ANY, true, OptionsCategory::/ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::/' $(git grep --files-with-matches 'AddArg(' src) sed -i 's/ArgsManager::ALLOW_ANY, false, OptionsCategory::/ArgsManager::ALLOW_ANY, OptionsCategory::/' $(git grep --files-with-matches 'AddArg(' src) -END VERIFY SCRIPT-
2019-07-27scripted-diff: Use Flags enum in AddArg()Hennadii Stepanov
-BEGIN VERIFY SCRIPT- sed -i 's/const bool debug_only,/unsigned int flags, &/' src/util/system.h src/util/system.cpp sed -i -E 's/(true|false), OptionsCategory::/ArgsManager::ALLOW_ANY, &/' $(git grep --files-with-matches 'AddArg(' src) -END VERIFY SCRIPT-
2019-07-27Add Flags enum to ArgsManagerHennadii Stepanov
2019-07-24Add CheckDataDirOption() functionHennadii Stepanov
2019-07-24Refactor out translation.hHennadii Stepanov
This is a prerequisite for introducing bilingual error messages. Note: #includes are arranged by clang-format-diff.py script.