aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2023-05-22Merge bitcoin/bitcoin#25796: rpc: add `descriptorprocesspsbt` rpcAndrew Chow
1bce12acd3e271a7c88d9400b4e3a5645bc8a911 test: add test for `descriptorprocesspsbt` RPC (ishaanam) fb2a3a70e860aa87fb7a21f6554ed9f3ce901e2d rpc: add descriptorprocesspsbt rpc (ishaanam) Pull request description: This PR implements an RPC called `descriptorprocesspsbt`. This RPC is based off of `walletprocesspsbt`, but instead of interacting with the wallet to update, sign and finalize a psbt, it instead accepts an array of output descriptors and uses that information along with information from the mempool, txindex, and the utxo set to do so. `utxoupdatepsbt` also updates a psbt in this manner, but doesn't sign or finalize it. Because of this overlap, a helper function that is added in this PR is called by both `utxoupdatepsbt` and `descriptorprocesspsbt`. Whether or not the helper function signs a psbt is dictated by if the HidingSigningProvider passed to it contains any private information. There is also a test added in this PR for this new RPC that uses p2wsh, p2wpkh, and legacy outputs. Edit: see https://github.com/bitcoin/bitcoin/pull/25796#issuecomment-1228830963 ACKs for top commit: achow101: re-ACK 1bce12acd3e271a7c88d9400b4e3a5645bc8a911 instagibbs: reACK https://github.com/bitcoin/bitcoin/pull/25796/commits/1bce12acd3e271a7c88d9400b4e3a5645bc8a911 Tree-SHA512: e1d0334739943e71f2ee68b4db7637ebe725da62e7aa4be071f71c7196d2a5970a31ece96d91e372d34454cde8509e95ab0eebd2c8edb94f7d5a781a84f8fc5d
2023-05-22Merge bitcoin/bitcoin#27672: fuzz: Print error message when FUZZ is missingfanquake
fa1b3abc834a90fb1cfbd5ac63deb28f3990c1fb ci: Log qa-assets repo last commit (MarcoFalke) fa22966f3307e22b77ea386e1abb60bf8c606170 fuzz: Print error message when FUZZ is missing (MarcoFalke) Pull request description: Some trivial UX improvements. * Change the exit code for `PRINT_ALL_FUZZ_TARGETS_AND_ABORT` and `WRITE_ALL_FUZZ_TARGETS_AND_ABORT` to `EXIT_SUCCESS` instead of `Aborted (core dumped)`. * Print readable error message when `FUZZ` is missing instead of `Aborted (core dumped)`. * Clarify that a fuzz target needs to be compiled into the executable. ACKs for top commit: dergoegge: ACK fa1b3abc834a90fb1cfbd5ac63deb28f3990c1fb Tree-SHA512: 065ef8920449c64b3516f89a61cb397b505eccf531318c4f3830895d5ff6cd7ae2525cb857320481e3d0ed0b2f8a522cd8f7835e69f021241b6ec297a6102fc8
2023-05-22fuzz: Print error message when FUZZ is missingMarcoFalke
Also, add missing includes.
2023-05-20random: switch to using getrandom() directlyfanquake
This requires a linux kernel of 3.17.0+, which seems entirely reasonable. 3.17 went EOL in 2015, and the last supported 3.x kernel (3.16) went EOL > 4 years ago, in 2020. For reference, the current oldest maintained kernel is 4.14 (released 2017, EOL Jan 2024). Support for `getrandom()` (and `getentropy()`) was added to glibc 2.25, https://sourceware.org/legacy-ml/libc-alpha/2017-02/msg00079.html, and we already require 2.27+. All that being said, I don't think you would encounter a current day system, running with kernel headers older than 3.17 (released 2014) but also having a glibc of 2.27+ (released 2018).
2023-05-20random: add [[maybe_unused]] to GetDevURandomfanquake
Rather than multiple instances of (void)GetDevURandom to silence compiler warnings.
2023-05-20random: getentropy on macOS does not need unistd.hfanquake
Remove it. Make this change, so in a future commit, we can combine #ifdefs, and avoid duplicate <sys/random.h> includes once we switch to using getrandom directly. Also remove the comment about macOS 10.12. We already require macOS > 10.15, so it is redundant.
2023-05-19Merge bitcoin/bitcoin#27021: Implement Mini version of BlockAssembler to ↵glozow
calculate mining scores 6b605b91c1faf2c7f7cc0c9d39b4fcfd66dc2965 [fuzz] Add MiniMiner target + diff fuzz against BlockAssembler (glozow) 3f3f2d59ea2946a7b7cc8cb0222fb602d62645d0 [unit test] GatherClusters and MiniMiner unit tests (glozow) 59afcc83548ea67a863dac7b75d000bc8f6a7023 Implement Mini version of BlockAssembler to calculate mining scores (glozow) 56484f0fdc44261e723563f59df886d5acdd851f [mempool] find connected mempool entries with GatherClusters(…) (glozow) Pull request description: Implement Mini version of BlockAssembler to calculate mining scores Run the mining algorithm on a subset of the mempool, only disturbing the mempool to copy out fee information for relevant entries. Intended to be used by wallet to calculate amounts needed for fee-bumping unconfirmed transactions. From comments of sipa and glozow below: > > In what way does the code added here differ from the real block assembly code? > > * Only operates on the relevant transactions rather than full mempool > * Has the ability to remove transactions that will be replaced so they don't impact their ancestors > * Does not hold mempool lock outside of the constructor, makes copies of the entries it needs instead (though I'm not sure if this has an effect in practice) > * Doesn't do the sanity checks like keeping weight within max block weight and `IsFinalTx()` > * After the block template is built, additionally calculates fees to bump remaining ancestor packages to target feerate ACKs for top commit: achow101: ACK 6b605b91c1faf2c7f7cc0c9d39b4fcfd66dc2965 Xekyo: > ACK [6b605b9](https://github.com/bitcoin/bitcoin/commit/6b605b91c1faf2c7f7cc0c9d39b4fcfd66dc2965) modulo `miniminer_overlap` test. furszy: ACK 6b605b91 modulo `miniminer_overlap` test. theStack: Code-review ACK 6b605b91c1faf2c7f7cc0c9d39b4fcfd66dc2965 Tree-SHA512: f86a8b4ae0506858a7b15d90f417ebceea5038b395c05c825e3796123ad3b6cb8a98ebb948521316802a4c6d60ebd7041093356b1e2c2922a06b3b96b3b8acb6
2023-05-19Merge bitcoin/bitcoin#27662: build: Bump minimum supported GCC to g++-9fanquake
fa953f15bfcf95df9aa9c91e1c4b56a205f4d1ae build: Bump minimum supported GCC to g++-9 (MarcoFalke) fa69955e741dd60dc6160e81cf223bbecd286806 ci: Bump centos:stream8 to centos:stream9 (MarcoFalke) fa6a755d9fb22cad3d7063b21a1c8a137ae981b2 ci: Document the false positive error for g++-9 (MarcoFalke) Pull request description: It is a bit frustrating to write valid C++ code only to realize that g++-8 fails to parse it later on. The only non-EOL operating system still shipping with g++-8 is CentOS Stream 8. I think it is reasonable for users of affected Linux distributions to: * Upgrade their operating system, or compiler to a supported version. * Alternatively, stay with a previous release of Bitcoin Core as long as it is supported. Fixes https://github.com/bitcoin/bitcoin/issues/27537 ACKs for top commit: hebasto: ACK fa953f15bfcf95df9aa9c91e1c4b56a205f4d1ae fanquake: ACK fa953f15bfcf95df9aa9c91e1c4b56a205f4d1ae Tree-SHA512: b9cf7e763d3071e1e008c5010de19601d4773afe46d58cf869d3f59285c53240c739a1cd7235a5525ede1bbdf6b6cb6fb091c8fc314864a28d5b27a400bb7632
2023-05-18Merge bitcoin/bitcoin#27556: wallet: fix deadlock in bdb read write operationAndrew Chow
69d43905b7f1d4849dfaea1b5744ee473ccc8744 test: add coverage for wallet read write db deadlock (furszy) 12daf6fcdcbf5c7f03038338d843df3877714b24 walletdb: scope bdb::EraseRecords under a single db txn (furszy) 043fcb0b053eee6021cc75e3d3f41097f52698c0 wallet: bugfix, GetNewCursor() misses to provide batch ptr to BerkeleyCursor (furszy) Pull request description: Decoupled from #26644 so it can closed in favor of #26715. Basically, with bdb, we can't make a write operation while we are traversing the db with the same db handler. These two operations are performed in different txn contexts and cause a deadlock. Added coverage by using `EraseRecords()` which is the simplest function that executes this process. To replicate it, need bdb support and drop the first commit. The test will run forever. ACKs for top commit: achow101: ACK 69d43905b7f1d4849dfaea1b5744ee473ccc8744 hebasto: re-ACK 69d43905b7f1d4849dfaea1b5744ee473ccc8744 Tree-SHA512: b3773be78925f674e962f4a5c54b398a9d0cfe697148c01c3ec0d68281cc5c1444b38165960d219ef3cf1a57c8ce6427f44a876275958d49bbc0808486e19d7d
2023-05-18Merge bitcoin/bitcoin#27689: doc: remove mention of glibc 2.10+fanquake
7014e080154f9c82e4fbe043af292a1e761cdb55 doc: remove mention of glibc 2.10+ (fanquake) Pull request description: We already require glibc 2.27+, so mentioning a much older version here is redundant. ACKs for top commit: TheCharlatan: ACK 7014e080154f9c82e4fbe043af292a1e761cdb55 Tree-SHA512: 883a566a80cabe34bfb5d902990f3eca08d0e11438e6c128d311e558f373ec232b0934deb85d12d796baacfeae590af8c73aa1b2faef07f27ffa9011270ffd96
2023-05-18build: Bump minimum supported GCC to g++-9MarcoFalke
Also, update the code to use constexpr, which does not work in g++-8. Also, drop the no longer needed build-aux/m4/l_filesystem.m4.
2023-05-17index: Enable reindex-chainstate with active indexesMartin Zumsande
This is achieved by letting the index sync thread wait until reindex-chainstate is finished. This also disables the pruning check when reindexing the chainstate (which is incompatible with prune mode) because there would be no chain at this point in init.
2023-05-17index: Use first block from locator instead of looking for fork pointMartin Zumsande
The index sync code has logic to go back the chain to the forking point, while also updating index-specific state, which is necessary to prevent possible corruption of the coinstatsindex. Also add a test for this (a reorg happens while the index is deactivated) that would not pass before this change.
2023-05-17doc: remove mention of glibc 2.10+fanquake
We already require glibc 2.27+, so mentioning a much older version here is redundant.
2023-05-16qt, test: Add missed headerHennadii Stepanov
Should fix MSVC link errors.
2023-05-16Merge bitcoin/bitcoin#27041: Build: Improve handling of suppressed logging ↵fanquake
in Makefiles 1b1ffbd014b931afb9435ec10911b9a7c130d3e5 Build: Log when test -f fails in Makefile (TheCharlatan) 541012e621386cd824eed81295206a34ba3ba497 Build: Use AM_V_GEN in Makefiles where appropriate (TheCharlatan) Pull request description: This PR triages some behavior around Makefile recipe echoing suppression. When generating new files as part of the Makefile the recipe is sometimes suppressed with $(AM_V_GEN) and sometimes with `@`. We should prefer $(AM_V_GEN), since this also prints the lines in silent mode. This is arguably more in style with the current recipe echoing. Before: `Generated test/data/script_tests.json.h` Now: ` GEN test/data/script_tests.json.h` A side effect of this change is that the recipe for generating build.h is now echoed on each make run. Arguably this makes its generation more transparent. Sometimes the error emitted by `test -f` is currently thrown without any logging. This makes it a bit harder to debug. Instead, print a helpful log message to point the developer in the right direction. Alternatively this could have been implemented by just removing the recipe echo suppression (@), but the subsequent make output became too noisy. ACKs for top commit: fanquake: ACK 1b1ffbd014b931afb9435ec10911b9a7c130d3e5 Tree-SHA512: e31869fab25e72802b692ce6735f9561912caea903c1577101b64c9cb115c98de01a59300e8ffe7b05b998345c1b64a79226231d7d1453236ac338c62dc9fbb3
2023-05-15walletdb: Remove unused CreateMockWalletDatabaseAndrew Chow
This has been superseded by the MockableDatabase. Remove to avoid confusion as to which type of mock database to use for testing.
2023-05-15test: add coverage for wallet read write db deadlockfurszy
2023-05-15walletdb: scope bdb::EraseRecords under a single db txnfurszy
so we erase all the records atomically or abort the entire procedure. and, at the same time, we can share the same db txn context for the db cursor and the erase functionality. extra note from the Db.cursor doc: "If transaction protection is enabled, cursors must be opened and closed within the context of a transaction" thus why added a `CloseCursor` call before calling to `TxnAbort/TxnCommit`.
2023-05-15wallet: bugfix, GetNewCursor() misses to provide batch ptr to BerkeleyCursorfurszy
If the batch ptr is not passed, the cursor will not use the db active txn context which could lead to a deadlock if the code tries to modify the db while it is traversing it. E.g. the 'EraseRecords()' function.
2023-05-15Merge bitcoin/bitcoin#26715: Introduce `MockableDatabase` for wallet unit testsfanquake
33e2b82a4fc990253ff77655f437c7aed336bc55 wallet, bench: Remove unused database options from WalletBenchLoading (Andrew Chow) 80ace042d8fece9be50bfef1be64c6e5720e87e6 tests: Modify records directly in wallet ckey loading test (Andrew Chow) b3bb17d5d07f51ac2e501e4a7a3bbcd17144070f tests: Update DuplicateMockDatabase for MockableDatabase (Andrew Chow) f0eecf5e408238c64b77b0a4974ba2b9edb17487 scripted-diff: Replace CreateMockWalletDB with CreateMockableWalletDB (Andrew Chow) 075962bc25a90661612fe4613cd50ea1cae21f52 wallet, tests: Include wallet/test/util.h (Andrew Chow) 14aa4cb1e44f089a6022a2b14a98bca4a7dd9a01 wallet: Move DummyDatabase to salvage (Andrew Chow) f67a385556c60b2e4788a378196a395fca0539f5 wallet, tests: Replace usage of dummy db with mockable db (Andrew Chow) 33c6245ac1ecdfe25b1ee4fd9e93c43393634ae3 Introduce MockableDatabase for wallet unit tests (Andrew Chow) Pull request description: For the wallet's unit tests, we currently use either `DummyDatabase` or memory-only versions of either BDB or SQLite. The tests that use `DummyDatabase` just need a `WalletDatabase` so that the `CWallet` can be constructed, while the tests using the memory-only databases just need a backing data store. There is also a `FailDatabase` that is similar to `DummyDatabase` except it fails be default or can have a configured return value. Having all of these different database types can make it difficult to write tests, particularly tests that work when either BDB or SQLite is disabled. This PR unifies all of these different unit test database classes into a single `MockableDatabase`. Like `DummyDatabase`, most functions do nothing and just return true. Like `FailDatabase`, the return value of some functions can be configured on the fly to test various failure cases. Like the memory-only databases, records can actually be written to the `MockableDatabase` and be retrieved later, but all of this is still held in memory. Using `MockableDatabase` completely removes the need for having BDB or SQLite backed wallets in the unit tests for the tests that are not actually testing specific database behaviors. Because `MockableDatabase`s can be created by each unit test, we can also control what records are stored in the database. Records can be added and removed externally from the typical database modification functions. This will give us greater ability to test failure conditions, particularly those involving corrupted records. Possible alternative to #26644 ACKs for top commit: furszy: ACK 33e2b82 TheCharlatan: ACK 33e2b82a4fc990253ff77655f437c7aed336bc55 Tree-SHA512: c2b09eff9728d063d2d4aea28a0f0e64e40b76483e75dc53f08667df23bd25834d52656cd4eafb02e552db0b9e619cfdb1b1c65b26b5436ee2c971d804768bcc
2023-05-11Merge bitcoin/bitcoin#27610: Improve performance of p2p inv to send queuesfanquake
5b3406094f2679dfb3763de4414257268565b943 net_processing: Boost inv trickle rate (Anthony Towns) 228e9201efb5574b1b96bb924de1d2e8dd1317f3 txmempool: have CompareDepthAndScore sort missing txs first (Anthony Towns) Pull request description: Couple of performance improvements when draining the inventory-to-send queue: * drop txs that have already been evicted from the mempool (or included in a block) immediately, rather than at the end of processing * marginally increase outgoing trickle rate during spikes in tx volume ACKs for top commit: willcl-ark: ACK 5b34060 instagibbs: ACK https://github.com/bitcoin/bitcoin/pull/27610/commits/5b3406094f2679dfb3763de4414257268565b943 darosior: utACK 5b3406094f2679dfb3763de4414257268565b943 glozow: code review ACK 5b3406094f2679dfb3763de4414257268565b943 dergoegge: utACK 5b3406094f2679dfb3763de4414257268565b943 Tree-SHA512: 155cd3b5d150ba3417c1cd126f2be734497742e85358a19c9d365f4f97c555ff9e846405bbeada13c3575b3713c3a7eb2f780879a828cbbf032ad9a6e5416b30
2023-05-11Merge bitcoin/bitcoin#27125: refactor, kernel: Decouple ArgsManager from ↵fanquake
blockstorage 5ff63a09a9edd1204b2cc56cf6f48a44adab7bb3 refactor, blockstorage: Replace stopafterblockimport arg (TheCharlatan) 18e5ba7c8002bcd473ee29ce4b5bfc56df6142a4 refactor, blockstorage: Replace blocksdir arg (TheCharlatan) 02a0899527ba3d31329e56c791c9dbf36075bb84 refactor, BlockManager: Replace fastprune from arg with options (TheCharlatan) a498d699e3fdac5bfdb33020a1fd6c4a79989752 refactor/iwyu: Complete includes for blockmanager_args (TheCharlatan) f0bb1021f0d60f5f19176e67a66fcf7c325f88d1 refactor: Move functions to BlockManager methods (TheCharlatan) cfbb2124939822e95265a39242ffca3d86bac6e8 zmq: Pass lambda to zmq's ZMQPublishRawBlockNotifier (TheCharlatan) 8ed4ff8e05d61a8e954d72cebdc2e1d1ab24fb84 refactor: Declare g_zmq_notification_interface as unique_ptr (TheCharlatan) Pull request description: The libbitcoin_kernel library should not rely on the `ArgsManager`, but rather use option structs that can be passed to the various classes it uses. This PR removes reliance on the `ArgsManager` from the `blockstorage.*` files. Like similar prior work, it uses the options struct in the `BlockManager` that can be populated with `ArgsManager` values. Some related prior work: https://github.com/bitcoin/bitcoin/pull/26889 https://github.com/bitcoin/bitcoin/pull/25862 https://github.com/bitcoin/bitcoin/pull/25527 https://github.com/bitcoin/bitcoin/pull/25487 Related PR removing blockstorage globals: https://github.com/bitcoin/bitcoin/pull/25781 ACKs for top commit: ryanofsky: Code review ACK 5ff63a09a9edd1204b2cc56cf6f48a44adab7bb3. Since last ACK just added std::move and fixed commit title. Sorry for the noise! mzumsande: Code Review ACK 5ff63a09a9edd1204b2cc56cf6f48a44adab7bb3 Tree-SHA512: 4bde8fd140a40b97eca923e9016d85dcea6fad6fd199731f158376294af59c3e8b163a0725aa47b4be3519b61828044e0a042deea005e0c28de21d8b6c3e1ea7
2023-05-10Merge bitcoin/bitcoin#19690: util: improve FindByte() performanceAndrew Chow
72efc26439da9a1344a19569fb0cab01f82ae7d1 util: improve streams.h:FindByte() performance (Larry Ruane) 604df63f6c70b9692b067777ddb38d946ac0b2fc [bench] add streams findbyte (gzhao408) Pull request description: This PR is strictly a performance improvement; there is no functional change. The `CBufferedFile::FindByte()` method searches for the next occurrence of the given byte in the file. Currently, this is done by explicitly inspecting each byte in turn. This PR takes advantage of `std::find()` to do the same more efficiently, improving its CPU runtime by a factor of about 25 in typical use. ACKs for top commit: achow101: re-ACK 72efc26439da9a1344a19569fb0cab01f82ae7d1 stickies-v: re-ACK 72efc26439da9a1344a19569fb0cab01f82ae7d1 Tree-SHA512: ddf0bff335cc8aa34f911aa4e0558fa77ce35d963d602e4ab1c63090b4a386faf074548daf06ee829c7f2c760d06eed0125cf4c34e981c6129cea1804eb3b719
2023-05-10refactor, blockstorage: Replace stopafterblockimport argTheCharlatan
Add a stop_after_block_import field to the BlockManager options. Use this field instead of the global gArgs. This should allow users of the BlockManager to not rely on the global Args.
2023-05-10refactor, blockstorage: Replace blocksdir argTheCharlatan
Add a blocks_dir field to the BlockManager options. Move functions relying on the global gArgs to get the blocks_dir into the BlockManager class. This should eventually allow users of the BlockManager to not rely on the global Args and instead pass in their own options.
2023-05-10refactor, BlockManager: Replace fastprune from arg with optionsTheCharlatan
Remove access to the global gArgs for the fastprune argument and replace it by adding a field to the existing BlockManager Options struct. When running `clang-tidy-diff` on this commit, there is a diagnostic error: `unknown type name 'uint64_t' [clang-diagnostic-error] uint64_t prune_target{0};`, which is fixed by including cstdint. This should eventually allow users of the BlockManager to not rely on the global gArgs and instead pass in their own options.
2023-05-10refactor/iwyu: Complete includes for blockmanager_argsTheCharlatan
2023-05-10refactor: Move functions to BlockManager methodsTheCharlatan
This is a commit in preparation for the next few commits. The functions are moved to methods to avoid their re-declaration for the purpose of passing in BlockManager options. The functions that were now moved into the BlockManager should no longer use the params as an argument, but instead use the member variable. In the moved ReadBlockFromDisk and UndoReadFromDisk, change the function signature to accept a reference to a CBlockIndex instead of a raw pointer. The pointer is expected to be non-null, so reflect that in the type. To allow for the move of functions to BlockManager methods all call sites require an instantiated BlockManager, or a callback to one.
2023-05-10zmq: Pass lambda to zmq's ZMQPublishRawBlockNotifierTheCharlatan
The lambda captures a reference to the chainman unique_ptr to retrieve block data. An assert is added on the chainman to ensure that the lambda is not used while the chainman is uninitialized. This is done in preparation for the following commits where blockstorage functions are made BlockManager methods.
2023-05-10Merge bitcoin/bitcoin#27605: refactor: Replace global find_value function ↵Andrew Chow
with UniValue::find_value method fa266c4bbf564308ddbc12653527226506902084 Temporarily work around gcc-13 warning bug in interfaces_tests (MarcoFalke) fa28850562bda0c2049aaff42103dfa6f05395dc Fix clang-tidy performance-unnecessary-copy-initialization warnings (MarcoFalke) faaa60a30e7738a1490c9c2bb8963420f53c7f2d Remove unused find_value global function (MarcoFalke) fa422aeec2909df0151177816dc1ff5eb5a1fbab scripted-diff: Use UniValue::find_value method (MarcoFalke) fa548ac872c094edc94c2afda5cc9b0d84f73af0 Add UniValue::find_value method (MarcoFalke) Pull request description: The global function has issues: * It causes gcc-13 warnings, see https://github.com/bitcoin/bitcoin/issues/26926 * There is no rationale for it being a global function, when it acts like a member function * `performance-unnecessary-copy-initialization` clang-tidy isn't run on it Fix all issues by making it a member function. ACKs for top commit: achow101: ACK fa266c4bbf564308ddbc12653527226506902084 hebasto: re-ACK fa266c4bbf564308ddbc12653527226506902084 Tree-SHA512: 6c4e25da3122cd3b91c376bef73ea94fb3beb7bf8ef5cb3853c5128d95bfbacbcbfb16cc843eb7b1a7ebd350c2b6311f8085eeacf9aeeab3366987037d209e44
2023-05-10Merge bitcoin/bitcoin#27611: refactor: Use ChainType enum exhaustivelyfanquake
e23088707be2c3bf247f4b777290c8e401db48cb refactor: Use ChainType enum exhaustively (TheCharlatan) Pull request description: This is a follow up of https://github.com/bitcoin/bitcoin/pull/27491, more concretely https://github.com/bitcoin/bitcoin/pull/27491#discussion_r1188847896, for not using default cases (as per the style guide), and https://github.com/bitcoin/bitcoin/pull/27491#discussion_r1188852707 and https://github.com/bitcoin/bitcoin/pull/27491#discussion_r1188851857 for avoiding dead code. ACKs for top commit: fanquake: ACK e23088707be2c3bf247f4b777290c8e401db48cb - deals with almost all follow up comments out of #27491. Tree-SHA512: 1794190b03b91d3ca349a4da08e9610dbb3432983eee7cb21ecc758d1d7d710560c97661de14cdf493c28c00ebe8977511b4696055c0940e7f815b622dbacd16
2023-05-10refactor: Declare g_zmq_notification_interface as unique_ptrTheCharlatan
Ensures better memory safety for this global. This came up during discussion of the following commit, but is not strictly required for its implementation.
2023-05-10refactor: Use ChainType enum exhaustivelyTheCharlatan
This is a follow up of https://github.com/bitcoin/bitcoin/pull/27491, more concretely https://github.com/bitcoin/bitcoin/pull/27491#discussion_r1188847896, for not using default cases (as per the style guide), and https://github.com/bitcoin/bitcoin/pull/27491#discussion_r1188852707 and https://github.com/bitcoin/bitcoin/pull/27491#discussion_r1188851857 for avoiding dead code. Also change chain name to chain type in docstrings
2023-05-10net_processing: Boost inv trickle rateAnthony Towns
If transactions are being added to the mempool at a rate faster than 7tx/s (INVENTORY_BROADCAST_PER_SECOND) then peers' inventory_to_send queue can become relatively large. If this happens, increase the number of txids we include in an INV message (normally capped at 35) by 5 for each 1000 txids in the queue. This will tend to clear a temporary excess out reasonably quickly; an excess of 4000 invs to send will be cleared down to 1000 in about 30 minutes, while an excess of 20000 invs would be cleared down to 1000 in about 60 minutes.
2023-05-10txmempool: have CompareDepthAndScore sort missing txs firstAnthony Towns
We use CompareDepthAndScore to choose an order of txs to inv. Rather than sorting txs that have been evicted from the mempool at the end of the list, sort them at the beginning so they are removed from the queue immediately.
2023-05-09Temporarily work around gcc-13 warning bug in interfaces_testsMarcoFalke
This can be reverted once gcc excludes lambdas with decltype(auto) return type from its -Wdangling-reference analysis.
2023-05-09p2p: Avoid prematurely clearing download state for other peersSuhas Daftuar
2023-05-09Fix clang-tidy performance-unnecessary-copy-initialization warningsMarcoFalke
2023-05-09Remove unused find_value global functionMarcoFalke
2023-05-09scripted-diff: Use UniValue::find_value methodMarcoFalke
-BEGIN VERIFY SCRIPT- sed --regexp-extended -i 's/find_value\(([^ ,]+), /\1.find_value(/g' $(git grep -l find_value) -END VERIFY SCRIPT-
2023-05-09Add UniValue::find_value methodMarcoFalke
2023-05-09Merge bitcoin/bitcoin#27491: refactor: Move chain constants to the util libraryfanquake
d168458d1ff987e0d741c75ac1d4b63ae0cfb7e7 scripted-diff: Remove unused chainparamsbase includes (TheCharlatan) e9ee8aaf3acdf6dce2b339916d4c602484570050 Add missing definitions in prep for scripted diff (TheCharlatan) ba8fc7d788932b25864fb260ca14983aa2398c23 refactor: Replace string chain name constants with ChainTypes (TheCharlatan) 401453df419af35957ec711423ac3d93ad512fe8 refactor: Introduce ChainType getters for ArgsManager (TheCharlatan) bfc21c31b2186f7d30fc9a9ca7d6887ab61c6fb9 refactor: Create chaintype files (TheCharlatan) 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". It is also a follow up to #26177. It replaces pull request https://github.com/bitcoin/bitcoin/pull/27294, which just moved the constants to a new file, but did not re-declare them as enums. The code move of the chain name constants out of the `chainparamsbase` to their own separate header allows the kernel `chainparams` to no longer include `chainparamsbase`. The `chainparamsbase` contain references to the `ArgsManager` and networking related options that should not belong to the kernel library. Besides this move, the constants are re-declared as enums with helper functions facilitating string conversions. ACKs for top commit: ryanofsky: Code review ACK d168458d1ff987e0d741c75ac1d4b63ae0cfb7e7. Just suggested changes since last review. Tree-SHA512: ac2fbe5cbbab4f52eae1e30af1f16700b6589eb4764c328a151a712adfc37f326cc94a65c385534c57d4bc92cc1a13bf1777d92bc924a20dbb30440e7380b316
2023-05-09Merge bitcoin/bitcoin#27594: refactor: Remove unused GetTimeMillisfanquake
fae1d9cdede0e88cabbf8130869be31276457c34 refactor: Remove unused GetTimeMillis (MarcoFalke) Pull request description: The function is unused, not type-safe, and does not denote the underlying clock type. So remove it. ACKs for top commit: willcl-ark: tACK fae1d9cded Tree-SHA512: 41ea7125d1964192b85a94265be974d02bf1e79b1feb61bff11486dc0ac811745156940ec5cad2ad1f94b653936f8ae563c959c1c4142203a55645fcb83203e8
2023-05-09scripted-diff: Remove unused chainparamsbase includesTheCharlatan
This is a follow-up to previous commits moving the chain constants out of chainparamsbase. The script removes the chainparamsbase header in all files where it is included, but not used. This is done by filtering against all defined symbols of the header as well as its respective .cpp file. The kernel chainparams now no longer relies on chainparamsbase. -BEGIN VERIFY SCRIPT- sed -i '/#include <chainparamsbase.h>/d' $( git grep -l 'chainparamsbase.h' | xargs grep -L 'CBaseChainParams\|CreateBaseChainParams\|SetupChainParamsBaseOptions\|BaseParams\|SelectBaseParams\|chainparamsbase.cpp' ) -END VERIFY SCRIPT-
2023-05-09Add missing definitions in prep for scripted diffTheCharlatan
The missing include and ArgsManager were found after applying the scripted diff in the following commit.
2023-05-09refactor: Replace string chain name constants with ChainTypesTheCharlatan
This commit effectively moves the definition of these constants out of the chainparamsbase to their own file. Using the ChainType enums provides better type safety compared to passing around strings. The commit is part of an ongoing effort to decouple the libbitcoinkernel library from the ArgsManager and other functionality that should not be part of the kernel library.
2023-05-09Merge bitcoin/bitcoin#27575: Introduce platform-agnostic `ALWAYS_INLINE` macrofanquake
3f19875d667522412408d06873e87ff8150e49c4 scripted-diff: Use platform-agnostic `ALWAYS_INLINE` macro (Hennadii Stepanov) e16c22fe025f82166c7f3f15a37c96bf4a06e4cf Introduce platform-agnostic `ALWAYS_INLINE` macro (Hennadii Stepanov) Pull request description: Split from https://github.com/bitcoin/bitcoin/pull/24773 as requested in https://github.com/bitcoin/bitcoin/pull/24773#issuecomment-1534954977. ACKs for top commit: theuni: utACK 3f19875d667522412408d06873e87ff8150e49c4 fanquake: ACK 3f19875d667522412408d06873e87ff8150e49c4 Tree-SHA512: a19b713433bb4d3c5fff1ddb4d1413837823a400c1d46363a8181e7632b059846ba92264be1c867f35f532af90945ed20887103471b09c07623e0f3905b4098b
2023-05-09refactor: Introduce ChainType getters for ArgsManagerTheCharlatan
These are introduced for the next commit where the usage of the ChainType is adopted throughout the code. Co-authored-by: Russell Yanofsky <russ@yanofsky.org> Co-authored-by: TheCharlatan <seb.kung@gmail.com>
2023-05-09refactor: Create chaintype filesTheCharlatan
This is the first of a number of commits with the goal of moving the chain type definitions out of chainparamsbase to their own file and implementing them as enums instead of constant strings. The goal is to allow the kernel chainparams to no longer include chainparamsbase. The commit is part of an ongoing effort to decouple the libbitcoinkernel library from the ArgsManager and other functionality that should not be part of the kernel library.