aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2023-04-03net: add `GetMappedAS` in `CConnman`brunoerg
2023-04-03refactor: don't avoid sys/types.h on when building for Windowsfanquake
We've already used it unguarded in `httpserver.cpp` for years, with no build issues.
2023-04-03Merge bitcoin/bitcoin#27254: refactor: Extract util/fs from util/systemfanquake
00e9b97f37e0bdf4c647236838c10b68b7ad5be3 refactor: Move fs.* to util/fs.* (TheCharlatan) 106b46d9d25b5228ef009fbbe6f9a7ae35090d15 Add missing fs.h includes (TheCharlatan) b202b3dd6393b415fa68e18dc49c9431dc6b58b2 Add missing cstddef include in assumptions.h (TheCharlatan) 18fb36367a28819bd5ab402344802796a1248979 refactor: Extract util/fs_helpers from util/system (Ben Woosley) Pull request description: This pull request is part of the `libbitcoinkernel` project https://github.com/bitcoin/bitcoin/issues/24303 https://github.com/bitcoin/bitcoin/projects/18 and more specifically its "Step 2: Decouple most non-consensus code from libbitcoinkernel". This commit was originally authored by empact and is taken from its parent PR #25152. #### Context There is an ongoing effort to decouple the `ArgsManager` used for command line parsing user-provided arguments from the libbitcoinkernel library (https://github.com/bitcoin/bitcoin/pull/25290, https://github.com/bitcoin/bitcoin/pull/25487, https://github.com/bitcoin/bitcoin/pull/25527, https://github.com/bitcoin/bitcoin/pull/25862, https://github.com/bitcoin/bitcoin/pull/26177, and https://github.com/bitcoin/bitcoin/pull/27125). The `ArgsManager` is defined in `system.h`. A similar pull request extracting functionality from `system.h` has been merged in https://github.com/bitcoin/bitcoin/pull/27238. #### Changes Next to providing better code organization, this PR removes some reliance of the tree of libbitcoinkernel header includes on `system.h` (and thus the `ArgsManager` definition) by moving filesystem related functions out of the `system.*` files. There is already a pair of `fs.h` / `fs.cpp` in the top-level `src/` directory. They were not combined with the files introduced here, to keep the patch cleaner and more importantly because they are often included without the utility functions. The new files are therefore named `fs_helpers` and the existing `fs` files are moved into the util directory. Further commits splitting more functionality out of `system.h` are still in #25152 and will be submitted in separate PRs once this PR has been processed. ACKs for top commit: hebasto: ACK 00e9b97f37e0bdf4c647236838c10b68b7ad5be3 Tree-SHA512: 31422f148d14ba3c843b99b1550a6fd77c77f350905ca324f93d4f97b652246bc58fa9696c64d1201979cf88733e40be02d262739bb7d417cf22bf506fdb7666
2023-04-02Merge bitcoin/bitcoin#27382: miniscript: explicit cast instead of comparing ↵fanquake
integers of different signs 9a54d88c8cb0c5d529f388c2ce53008e1ff126dd miniscript: explicit cast instead of comparing integers of different signs (Antoine Poinsot) Pull request description: Fixes #27381 ACKs for top commit: stickies-v: ACK 9a54d88c8cb0c5d529f388c2ce53008e1ff126dd Tree-SHA512: beba35ecf3325b3b0e87f3288af4522de455c2983f7f6dd64a34a1636e351afcd1e00d249dfe2b3cde4f65254d62b610daaebfbda4e4af76f1fef4dd168c631d
2023-04-02Merge bitcoin/bitcoin#27379: net processing: #26140 follow-upsfanquake
3fa4c54ac54b2d738e0c43b57b5c232ee02fe3b3 [net processing] Pass TxRelay to FindTxForGetData instead of Peer (dergoegge) c85ee76a3647a42d3a59c28444c5ca52e7db7c5e [net processin] Don't take cs_main in FindTxForGetData (dergoegge) Pull request description: Addresses left over feedback from #26140. * https://github.com/bitcoin/bitcoin/pull/26140#discussion_r1153498543 * https://github.com/bitcoin/bitcoin/pull/26140#discussion_r1153499627 `mapRelay` is only accessed from the message processing thread and does not need to be kept in sync with anything validation specific, it is therfore perfectly fine to have it guarded by `g_msgproc_mutex`. ACKs for top commit: jnewbery: utACK 3fa4c54ac54b2d738e0c43b57b5c232ee02fe3b3 hebasto: ACK 3fa4c54ac54b2d738e0c43b57b5c232ee02fe3b3, I have reviewed the code and it looks OK, I agree it can be merged. Tree-SHA512: 3ef84bfe4abfa8d991a7e65d9184221294d80e0df0bbb47f0270ab6ca1593266c98abf83c610f9f86b4d16c7a4b62bcf83f8856c68d3c2e10894bff6ed3e88cd
2023-04-01Merge bitcoin-core/gui#724: Update translation source file for v25.0 string ↵Hennadii Stepanov
freeze e414edd8fc88b55a91f446dcc4d55cc4cd6d32e7 qt: Update translation source file (Hennadii Stepanov) b7800950913c47bc1a939bd7f99c6b0629aea530 qt: Adjust plural forms for translations (Hennadii Stepanov) 6ae8a24009cb006476b3be612a34e4deda30433a GUI: Send: Make feerates translatable (Luke Dashjr) bd42f5e1cdb0cbd829c8fe1700d036b681f3930d Bugfix: GUI: Send/PSBT: Correct virtual size unit and make translatable (Luke Dashjr) 1b0407f5f1f5902f67b58c7ada9c4b0c45457244 Bugfix: GUI: transactiondesc: Translate outlier "own address" and "watch-only" (Luke Dashjr) 170f3126f220f9ffe3db471e0024a23dede3f90b GUI: Use translated external signer errors for messagebox text (Luke Dashjr) 96989599d6c7264022c188babdcd9cacac9ab69f GUI: Make messages for copying unsigned PSBTs translatable (Luke Dashjr) 08b8b287d3762dd6d4be09fad0b71c4cacfe6658 Bugfix: GUI: Debug info: Use correct "kB" case for small mempool sizes, and make translation-friendly (Luke Dashjr) dacc322be10c6709338d2f0d7f5c4366609ad1a0 GUI: PSBTOperationsDialog: Support translating window title (Luke Dashjr) 5a4fe5527045ad3d7f1c834c3c6ea1d531c87879 GUI: Intro: Support translating caption of data directory chooser (Luke Dashjr) 3868ba3a27d594dd2968548fff3db457cbeb0080 GUI: Support translating peer network names (Luke Dashjr) f1f981119884389f1f355bc11847a73812a2836e GUI: Support translating address type dropdown entries (Luke Dashjr) Pull request description: This PR updates the `src/qt/locale/bitcoin_en.xlf` translation source file according to [Release schedule for 25.0](https://github.com/bitcoin/bitcoin/issues/26549). Some translation-related fixes have been picked from https://github.com/bitcoin-core/gui/pull/599 and https://github.com/bitcoin-core/gui/pull/716. Note for reviewers: it is expected to get a zero diff after running `make -C src translate` locally. ACKs for top commit: jarolrod: ACK e414edd8fc88b55a91f446dcc4d55cc4cd6d32e7 Tree-SHA512: 5b0c70db1e2f5871067e84f43ebea4ee4f0027fc5f2be49bbcb1d04e162ae76607b2b038e9d0622bcb5b3658d0ede8c10c4421ddaa3343f0e0be54315ca7a4f5
2023-03-31Merge bitcoin/bitcoin#27274: refactor: remove unused param from legacy ↵fanquake
pubkey interface 1869310f3cfa4ab26b5090d8a4002eefdc84870e refactor: remove unused param from legacy pubkey (Bushstar) Pull request description: Unused param present in legacy pubkey manager interface. This param will not be used and should be removed to prevent unintended usage. ACKs for top commit: Sjors: ACK 1869310f3cfa4ab26b5090d8a4002eefdc84870e furszy: ACK 1869310f3cfa4ab26b5090d8a4002eefdc84870e Tree-SHA512: 0fb41fc8f481f859262f2e8e9a93c990c1b4637e74fd9191ccc0b3c523d0e7d94217a3074bb357276e1941a10d29326f850f9b27eccc1eca57cf6b549353400c
2023-03-31miniscript: explicit cast instead of comparing integers of different signsAntoine Poinsot
2023-03-31qt: Update translation source fileHennadii Stepanov
The diff is produced by running `make -C src translate`.
2023-03-31qt: Adjust plural forms for translationsHennadii Stepanov
2023-03-31GUI: Send: Make feerates translatableLuke Dashjr
2023-03-31Bugfix: GUI: Send/PSBT: Correct virtual size unit and make translatableLuke Dashjr
2023-03-31Bugfix: GUI: transactiondesc: Translate outlier "own address" and "watch-only"Luke Dashjr
2023-03-31GUI: Use translated external signer errors for messagebox textLuke Dashjr
2023-03-31GUI: Make messages for copying unsigned PSBTs translatableLuke Dashjr
2023-03-31Bugfix: GUI: Debug info: Use correct "kB" case for small mempool sizes, and ↵Luke Dashjr
make translation-friendly
2023-03-31GUI: PSBTOperationsDialog: Support translating window titleLuke Dashjr
2023-03-31GUI: Intro: Support translating caption of data directory chooserLuke Dashjr
2023-03-31GUI: Support translating peer network namesLuke Dashjr
2023-03-31GUI: Support translating address type dropdown entriesLuke Dashjr
2023-03-31[net processing] Pass TxRelay to FindTxForGetData instead of Peerdergoegge
2023-03-31[net processin] Don't take cs_main in FindTxForGetDatadergoegge
Taking cs_main is no longer necessary since we moved `m_recently_announced_invs` to `Peer` and `mapRelay` is actually only accessed from the message processing thread.
2023-03-30Implement Mini version of BlockAssembler to calculate mining scoresglozow
Rewrite the same algo instead of reusing BlockAssembler because we have a few extra requirements that would make the changes invasive and difficult to review: - Only operate on the relevant transactions rather than full mempool - Remove transactions that will be replaced so they can't bump their ancestors - Don't hold mempool lock outside of the constructor - Skip things like max block weight and IsFinalTx - Additionally calculate fees to bump remaining ancestor packages to target feerate Co-authored-by: Murch <murch@murch.one>
2023-03-30scripted-diff: Rename nUnconnectingHeaders and fPreferHeadersdergoegge
-BEGIN VERIFY SCRIPT- ren() { sed -i "s:\<$1\>:$2:g" $(git grep -l "\<$1\>" ./src ./test); } ren nUnconnectingHeaders m_num_unconnecting_headers_msgs ren fPreferHeaders m_prefers_headers ren MAX_UNCONNECTING_HEADERS MAX_NUM_UNCONNECTING_HEADERS_MSGS -END VERIFY SCRIPT-
2023-03-30[net processing] Move m_recently_announced_invs from CNodeState to Peerdergoegge
2023-03-30[net processing] Annotate m_recently_announced_invs as guarded by ↵dergoegge
g_msgproc_mutex
2023-03-30[net processing] Move fPreferHeaders from CNodeState to Peerdergoegge
2023-03-30[net processing] Annotate fPreferHeaders as guarded by g_msgproc_mutexdergoegge
2023-03-30[net processing] Move m_headers_sync_timeout from CNodeState to Peerdergoegge
2023-03-30[net processing] Annotate m_headers_sync_timeout as guarded by g_msgproc_mutexdergoegge
2023-03-30[net processing] Move nUnconnectingHeaders from CNodeState to Peerdergoegge
2023-03-30[net processing] Annotate nUnconnectingHeaders as guarded by g_msgproc_mutexdergoegge
2023-03-30[validation] Annotate ChainstateManager::m_best_header as guarded by cs_maindergoegge
2023-03-30refactor: Drop no longer used `CNetMsgMaker` instancesHennadii Stepanov
2023-03-29validation: Move warningcache to ChainstateManagerdimitaracev
2023-03-28Merge bitcoin/bitcoin#27344: fuzz: Remove legacy int parse fuzz testsfanquake
faf8dc496e761a15956f8226d727f4bbab8dff82 fuzz: Remove legacy int parse fuzz tests (MarcoFalke) Pull request description: The fuzz tests checked that the result of the new function was equal to the legacy function. (Side note: The checks were incomplete, as evident by the follow-up fix in commit b5c9bb5cb9f4a8db57b33ef7399310c7d6de5822). Given that they haven't found any issues in years (beside missing the above issue, that they couldn't catch), it seems time to remove them. They may come in handy in the rare case that someone would want to modify `LocaleIndependentAtoi()` or `Parse*Int*()`, however that seems unlikely. Also, appropriate checks can be added then. ACKs for top commit: fanquake: ACK faf8dc496e761a15956f8226d727f4bbab8dff82 dergoegge: ACK faf8dc496e761a15956f8226d727f4bbab8dff82 Tree-SHA512: 4ec88b9fa8ba49a923b0604016f0f471b3c9b9e0ba6c5c3dc4e20503c6994789921e7221d9ec467a2a37a73f21a70ba51ba3370ed5ad311dee989e218290b29a
2023-03-28Merge bitcoin/bitcoin#27324: net: #27257 follow-upsfanquake
cd0c8eeb0940790b6ba83786d1c9e362d4dc4829 [net] Pass nRecvFloodSize to CNode (dergoegge) 860402ef2ed728ef096dda4e65e77d566782209f [net] Remove trivial GetConnectionType() getter (dergoegge) b5a85b365a4abd98176b0935015dbb502cc3e6f6 [net] Delete CNetMessage copy constructor/assignment op (dergoegge) Pull request description: Follow-up PR for #27257 * Deletes the copy constructor/assignment operator of `CNetMessage` * Removes trivial getter for the connection type * Avoids passing `nRecvFloodSize` to CNode methods by passing it to `CNode` on creation ACKs for top commit: jnewbery: utACK cd0c8eeb0940790b6ba83786d1c9e362d4dc4829 theStack: ACK cd0c8eeb0940790b6ba83786d1c9e362d4dc4829 Tree-SHA512: 673a758668617f69fba77e61f0eaa1538da27a4849c82c98742436692baa2d7f001129af3e7a66b160e599d12109dac08137a146f10ff9b9ebdc5c2237311d41
2023-03-27[mempool] find connected mempool entries with GatherClusters(…)glozow
We limit GatherClusters’s result to a maximum of 500 transactions as clusters can be made arbitrarily large by third parties. Co-authored-by: Murch <murch@murch.one>
2023-03-27test: Fix intermittent failure in ChainStateManager testsMartin Zumsande
Before wiping the ChainStateManager, the validationinterface queue must be drained to avoid accessing deleted memory.
2023-03-27Merge bitcoin-core/gui#693: Fix segfault when shutdown during wallet openHennadii Stepanov
9a1d73fdffa4f35e33bc187ac9b3afbba28b1950 Fix segfault when shutdown during wallet open (John Moffett) Pull request description: Fixes #689 ## Summary If you open a wallet and send a shutdown signal during that process, you'll get a segfault when the wallet finishes opening. That's because the `WalletController` object gets deleted manually in bitcoin.cpp during shutdown, but copies of the pointer (and pointers to child objects) are dangling in various places and are accessed in queued events after the deletion. ## Details The issue in #689 is caused by the following sequence of events: 1. Wallet open modal dialog is shown and worker thread does the actual work. 2. Every 200ms, the main event loop checks to see if a shutdown has been requested, but only if a modal is not being shown. 3. Request a shutdown while the modal window is shown. 4. The wallet open process completes, the modal window is dismissed, and various `finish` signals are sent. 5. During handling of one of the `finish` signals, `qApp->processEvents()` is [called](https://github.com/bitcoin-core/gui/blob/e9262ea32a6e1d364fb7974844fadc36f931f8c6/src/qt/sendcoinsdialog.cpp#L603), which causes the main event loop to detect the shutdown (now that the modal window has been dismissed). The `WalletController` and all the `WalletModel`s are [deleted](https://github.com/bitcoin-core/gui/blob/65de8eeeca29e71378aa34602b287ab921b040e4/src/qt/bitcoin.cpp#L394-L401). 6. Control returns to the `finish` method, which eventually tries to send a [signal](https://github.com/bitcoin-core/gui/blob/e9262ea32a6e1d364fb7974844fadc36f931f8c6/src/qt/sendcoinsdialog.cpp#L167) from a wallet model, but it's been deleted already (and the signal is sent from a now-[dangling](https://github.com/bitcoin-core/gui/blob/d8bdee0fc889def7c5f5076da13db4fce0a3728a/src/qt/walletview.cpp#L65) pointer). The simplest fix for that is to change the `qApp->processEvents()` into a `QueuedConnection` call. (The `qApp->processEvents() was a [workaround](https://github.com/bitcoin/bitcoin/pull/593#issuecomment-3050699) to get the GUI to scroll to the last item in a list that just got added, and this is just a safer way of doing that). However, once that segfault is fixed, another segfault occurs due to some queued wallet events happening after the wallet controller object is deleted here: https://github.com/bitcoin-core/gui/blob/65de8eeeca29e71378aa34602b287ab921b040e4/src/qt/bitcoin.cpp#L394-L401 Since `m_wallet_controller` is a copy of that pointer in `bitcoingui.cpp`, it's now dangling and `if(null)` checks won't work correctly. For instance, this line: https://github.com/bitcoin-core/gui/blob/65de8eeeca29e71378aa34602b287ab921b040e4/src/qt/bitcoingui.cpp#L413 sets up a `QueuedConnection` to `setCurrentWallet`, but by the time control reaches that method (one event cycle after shutdown deleted `m_wallet_controller` in `bitcoin.cpp`), the underlying objects have been destroyed (but the pointers are still dangling). Ideally, we'd use a `QPointer` or `std::shared_ptr / std::weak_ptr`s for these, but the changes would be more involved. This is a minimal fix for the issues. Just set `m_wallet_controller` to `nullptr` in `bitcoingui.cpp`, check its value in a couple places, and avoid a use of `qApp->processEvents`. ACKs for top commit: hebasto: ACK 9a1d73fdffa4f35e33bc187ac9b3afbba28b1950, I have reviewed the code and it looks OK. furszy: ACK https://github.com/bitcoin-core/gui/commit/9a1d73fdffa4f35e33bc187ac9b3afbba28b1950 Tree-SHA512: a1b94676eb2fcb7606e68fab443b1565b4122aab93c35382b561842a049f4b43fecc459535370d67a64d6ebc4bcec0ebcda981fff633ebd41bdba6f7093ea540
2023-03-27fuzz: Remove legacy int parse fuzz testsMarcoFalke
2023-03-27[net] Pass nRecvFloodSize to CNodedergoegge
2023-03-27[net] Remove trivial GetConnectionType() getterdergoegge
2023-03-27[net] Delete CNetMessage copy constructor/assignment opdergoegge
2023-03-27Merge bitcoin/bitcoin#26642: clang-tidy: Add more `performance-*` checks and ↵fanquake
related fixes 03ec5b6f9ca3af28c9ce25cf2393e28ae852d808 clang-tidy: Exclude `performance-*` checks rather including them (Hennadii Stepanov) 24004372302adfc0e7cb36f8db6830694bf050e9 clang-tidy: Add `performance-type-promotion-in-math-fn` check (Hennadii Stepanov) 7e975e6cf86617346c1d8e2568f74a0252c03857 clang-tidy: Add `performance-inefficient-vector-operation` check (Hennadii Stepanov) 516b75f66ec3ba7495fc028c750937bd66cc9bba clang-tidy: Add `performance-faster-string-find` check (Hennadii Stepanov) Pull request description: ACKs for top commit: martinus: ACK 03ec5b6f9ca3af28c9ce25cf2393e28ae852d808 TheCharlatan: re-ACK [03ec5b6](https://github.com/bitcoin/bitcoin/pull/26642/commits/03ec5b6f9ca3af28c9ce25cf2393e28ae852d808) Tree-SHA512: 2dfa52f9131da88826f32583bfd534a56a998477db9804b7333c0e7ac0b6b36141009755c7163b9f95d0ecbf5c2cb63f8a69ce4b114bb83423faed21b50cec67
2023-03-26clang-tidy: Exclude `performance-*` checks rather including themHennadii Stepanov
2023-03-26clang-tidy: Add `performance-type-promotion-in-math-fn` checkHennadii Stepanov
https://clang.llvm.org/extra/clang-tidy/checks/performance/type-promotion-in-math-fn.html
2023-03-26clang-tidy: Add `performance-inefficient-vector-operation` checkHennadii Stepanov
https://clang.llvm.org/extra/clang-tidy/checks/performance/inefficient-vector-operation.html
2023-03-26clang-tidy: Add `performance-faster-string-find` checkHennadii Stepanov
https://clang.llvm.org/extra/clang-tidy/checks/performance/faster-string-find.html
2023-03-26util: implement prevector's move ctor & move assignmentMartin Leitner-Ankerl
Using swap() was rather wasteful because it had to copy the whole direct memory data twice. Also, due to the swap() in move assignment the moved-from object might hold on to unused memory for longer than necessary.