aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2024-08-04logging: clarify -debug and -debugexclude descriptionsAnthony Towns
2024-08-04rpc: make logging method reject "0" category and correct the help textVasil Dimov
Current logging RPC method documentation claims to accept "0" and "none" categories, but the "none" argument is actually rejected and the "0" argument is ignored. Update the implementation to refuse both categories, and remove the help text claiming to support them.
2024-08-04logging, refactor: minor encapsulation improvement and use BCLog::NONE ↵Vasil Dimov
instead of 0 * Make the standalone function `LogCategoryToStr()` private inside `logging.cpp` (aka `static`) - it is only used in that file. * Make the method `Logger::GetLogPrefix()` `private` - it is only used within the class. * Use `BCLog::NONE` to initialize `m_categories` instead of `0`. We later check whether it is `BCLog::NONE` (in `Logger::DefaultShrinkDebugFile()`).
2024-08-04logging, refactor: make category special cases explicitRyan Ofsky
Make special cases explicit in GetLogCategory() and LogCategoryToStr() functions. Simplify the LOG_CATEGORIES_BY_STR and LOG_CATEGORIES_BY_FLAG mappings and LogCategoriesList() function. This makes the maps `LOG_CATEGORIES_BY_STR` and `LOG_CATEGORIES_BY_FLAG` consistent (one is exactly the opposite of the other).
2024-08-02Merge bitcoin/bitcoin#30567: qt, build: Drop `QT_STATICPLUGIN` macromerge-script
7231c7630e61c062440459963f7b00ccbec68f0f qt: Replace deprecated LogPrintf with LogInfo in GUIUtil::LogQtInfo() (Hennadii Stepanov) b3d3ae0680e7529853413de045aa9fbd7ac51e5c qt, build: Drop `QT_STATICPLUGIN` macro (Hennadii Stepanov) Pull request description: Broken out of https://github.com/bitcoin/bitcoin/pull/30454. Our `QT_STATICPLUGIN` macro is effectively equivalent to the Qt's `QT_STATIC` macro. It is easy to see in the `_BITCOIN_QT_IS_STATIC` macro implementation: https://github.com/bitcoin/bitcoin/blob/ebd82fa9fae13d5a7a395800295dd7fd34185b58/build-aux/m4/bitcoin_qt.m4#L269-L292 No need to handle both macros. ACKs for top commit: maflcko: re-ACK 7231c7630e61c062440459963f7b00ccbec68f0f TheCharlatan: ACK 7231c7630e61c062440459963f7b00ccbec68f0f Tree-SHA512: abbf21859b7ac2aaf47c5b0e075403e4cc9bc540b1565d23f51650b8932dde314586aca67fd4ed5daadebc89268baf8c18f65348fa2b836078ac24543c14cfd6
2024-08-02Merge bitcoin/bitcoin#30544: rpc: fix maybe-uninitialized compile warning in ↵merge-script
getchaintxstats 2e86f2b2019ea0edbd89dd3fd13540c5bbfa104d rpc: fix maybe-uninitialized compile warning in getchaintxstats (Michael Dietz) Pull request description: This resolves the compiler warning about potential uninitialized use of window_tx_count introduced in fa2dada. The warning: ``` CXX rpc/libbitcoin_node_a-blockchain.o rpc/blockchain.cpp: In function ‘getchaintxstats()::<lambda(const RPCHelpMan&, const JSONRPCRequest&)>’: rpc/blockchain.cpp:1742:38: warning: ‘*(std::_Optional_payload_base<unsigned int>::_Storage<unsigned int, true>*)((char*)&window_tx_count + offsetof(const std::optional<unsigned int>,std::optional<unsigned int>::<unnamed>.std::_Optional_base<unsigned int, true, true>::<unnamed>)).std::_Optional_payload_base<unsigned int>::_Storage<unsigned int, true>::_M_value’ may be used uninitialized in this function [-Wmaybe-uninitialized] 1742 | ret.pushKV("txrate", double(*window_tx_count) / nTimeDiff); | ``` ACKs for top commit: maflcko: lgtm ACK 2e86f2b2019ea0edbd89dd3fd13540c5bbfa104d theStack: ACK 2e86f2b2019ea0edbd89dd3fd13540c5bbfa104d tdb3: ACK 2e86f2b2019ea0edbd89dd3fd13540c5bbfa104d Tree-SHA512: c087e8f1cd68dd8df734a8400d30a95abe57ebd56cd53aef4230e425b33a23aa55b3af42abfd162e3be8c937a4c27e56abb70a4fedb10e2df64d52d577e0f262
2024-08-01Merge bitcoin/bitcoin#30548: release: Update translations for v28.0 soft ↵Hennadii Stepanov
translation string freeze be419674da66e9c349c9c35246c20a7b9fda2dd0 qt: Update translation source file (Hennadii Stepanov) e49d858aab9bfae2455d87226d9ebebbdf2c40c8 qt: Bump Transifex slug for 28.x (Hennadii Stepanov) 31b33019b7fe0c81ab1cfe0eeee03c3193de3f17 qt: Pull recent translations from Transifex (Hennadii Stepanov) Pull request description: This PR follows our [Release Process](https://github.com/bitcoin/bitcoin/blob/4c62f4b53561bce5b2eb8639cdc24d284be537eb/doc/release-process.md). Note: (possible) vandalism/damage has been prevented by reverting the deletion of `bitcoin_af`, `bitcoin_es_MX`, and `bitcoin_ru` translations. Required to open Transifex translations for v28.0 as it's scheduled in https://github.com/bitcoin/bitcoin/issues/29891. The previous similar PR: https://github.com/bitcoin/bitcoin/pull/29397. ACKs for top commit: stickies-v: ACK be419674da66e9c349c9c35246c20a7b9fda2dd0 Tree-SHA512: 76f7947af9c156c2aaf24c7f926f82e4d8e2664beb5ebde5c7cda8dd7a8dbf672b4a886302c8d189e0cb2145c0ed755f45f9cdb545e29d38bb1ec90ca18fa539
2024-08-01qt: Replace deprecated LogPrintf with LogInfo in GUIUtil::LogQtInfo()Hennadii Stepanov
2024-08-01qt, build: Drop `QT_STATICPLUGIN` macroHennadii Stepanov
Our `QT_STATICPLUGIN` macro is effectively equivalent to the Qt's `QT_STATIC` macro. No need to handle both of them.
2024-08-01Merge bitcoin/bitcoin#30532: refactor: remove deprecated TxidFromString() in ↵glozow
favour of transaction_identifier::FromHex() f553e6d86fe114e90585ea6d4b8e345a209cae5d refactor: remove TxidFromString (stickies-v) 285ab50ace4c04209f331ccaf121152b977cc490 test: replace WtxidFromString with Wtxid::FromHex (stickies-v) 9a0b2a69c4d836d7382f6fe7703de40288fc7421 fuzz: increase FromHex() coverage (stickies-v) 526a87ba6b4f20592ad3c090b82e83ecff2107fc test: add uint256::FromHex unittest coverage (stickies-v) Pull request description: Since https://github.com/bitcoin/bitcoin/pull/30482/commits/fab6ddbee64e50d5e2f499aebca35b5911896ec4, `TxidFromString()` has been deprecated because it is less robust than the `transaction_identifier::FromHex()` introduced in [the same PR](https://github.com/bitcoin/bitcoin/pull/30482). Specifically, it tries to recover from length-mismatches, recover from untrimmed whitespace, 0x-prefix and garbage at the end, instead of simply requiring exactly 64 hex-only characters. In this PR, `TxidFromString` is removed completely to clean up the code and prevent further unsafe usage. Unit and fuzz test coverage on `uint256::FromHex()` and functions that wrap it is increased. Note: `TxidFromSring` allowed users to prefix strings with "0x", this is no longer allowed for `transaction_identifier::FromHex()`, so a helper function for input validation may prove helpful in the future _(this overlaps with the `uint256::uint256S()` vs `uint256::FromHex()` future cleanup)_. It is not relevant to this PR, though, besides the fact that this unused (except for in tests) functionality is removed. The only users of `TxidFromString` are: - `test`, where it is straightforward to drop in the new `FromHex()` methods without much further concern - `qt` coincontrol. There is no need for input validation here, but txids are not guaranteed to be 64 characters. This is already handled by the existing code, so again, using `FromHex()` here seems quite straightforward. Addresses @maflcko's suggestion: https://github.com/bitcoin/bitcoin/pull/30482#discussion_r1691826934 Also removes `WtxidFromString()`, which is a test-only helper function. ### Testing GUI changes To test the GUI coincontrol affected lines, `regtest` is probably the easiest way to quickly get some test coins, you can use e.g. ``` alias cli="./src/bitcoin-cli -regtest" cli createwallet "coincontrol" # generate 10 spendable outputs on 1 address cli generatetoaddress 10 $(cli -rpcwallet=coincontrol getnewaddress) # generate 10 spendable outputs on another address cli generatetoaddress 10 $(cli -rpcwallet=coincontrol getnewaddress) # make previous outputs spendable cli generatetoaddress 100 $(cli -rpcwallet=coincontrol getnewaddress) ``` ACKs for top commit: maflcko: re-ACK f553e6d86fe114e90585ea6d4b8e345a209cae5d 🔻 hodlinator: ACK f553e6d86fe114e90585ea6d4b8e345a209cae5d paplorinc: ACK f553e6d86fe114e90585ea6d4b8e345a209cae5d TheCharlatan: Nice, ACK f553e6d86fe114e90585ea6d4b8e345a209cae5d Tree-SHA512: c1c7e6ea4cbf05cf660ba178ffc4f35f0328f7aa6ad81872e2462fb91a6a22e4681ff64b3d0202a5a9abcb650c939561585cd309164a69ab6081c0765ee271ef
2024-08-01Merge bitcoin/bitcoin#30413: p2p: Lazy init some bloom filters; fuzz version ↵glozow
handshake afd237bb5d85923273a69f7b45dc6aae6aa1680e [fuzz] Harness for version handshake (dergoegge) a90ab4aec9cccd44d867842d6a1161d5758fcb2c scripted-diff: Rename lazily initialized bloom filters (dergoegge) 82de1bc478d54bea6125b459febfb2fb23929c61 [net processing] Lazily initialize m_recent_confirmed_transactions (dergoegge) fa0c87f19c1eca47ee7052f3c988ff7273801ff3 [net processing] Lazily initialize m_recent_rejects_reconsiderable (dergoegge) 662e8db2d3efc651951315b295952a2eebb822cd [net processing] Lazily initialize m_recent_rejects (dergoegge) Pull request description: This adds a fuzzing harness dedicated to the version handshake. To avoid determinism issues, the harness creates necessary components each iteration (addrman, peerman, etc). A harness like this would have easily caught https://bitcoincore.org/en/2024/07/03/disclose-timestamp-overflow/. As a performance optimization, this PR includes a change to `PeerManager` to lazily initialize various filters (to avoid large unnecessary memory allocations each iteration). ACKs for top commit: brunoerg: ACK afd237bb5d85923273a69f7b45dc6aae6aa1680e marcofleon: Tested ACK afd237bb5d85923273a69f7b45dc6aae6aa1680e. I compared the coverage of `net_processing` from this harness to the `process_message` and `process_messages` harnesses to see the differences. This target hits more specific parts of the version handshake. The stability looks good as well, at about 94%. glozow: utACK afd237bb5d85923273a69f7b45dc6aae6aa1680e lazy blooms look ok mzumsande: Code Review ACK afd237bb5d85923273a69f7b45dc6aae6aa1680e Tree-SHA512: 62bba20aec0cd220e62368354891f9790b81ad75e8adf7b22a76a6d4663bd26aedc4cae8083658a75ea9043d60aad3f0e58ad36bd7bbbf93ff1d16e317bf15cc
2024-07-31refactor: remove TxidFromStringstickies-v
TxidFromString was deprecated due to missing 64-character length-check and hex-check, replace it with the more robust Txid::FromHex.
2024-07-31test: replace WtxidFromString with Wtxid::FromHexstickies-v
The newly introduced Wtxid::FromHex is more robust and removes the need for a WtxidFromString helper function
2024-07-31fuzz: increase FromHex() coveragestickies-v
2024-07-31test: add uint256::FromHex unittest coveragestickies-v
Simultaneously cover transaction_identifier::FromHex()
2024-07-31[fuzz] Harness for version handshakedergoegge
2024-07-31scripted-diff: Rename lazily initialized bloom filtersdergoegge
-BEGIN VERIFY SCRIPT- sed -i 's/m_recent_confirmed_transactions/m_lazy_recent_confirmed_transactions/g' $(git grep -l 'm_recent_confirmed_transactions') sed -i 's/m_recent_rejects_reconsiderable/m_lazy_recent_rejects_reconsiderable/g' $(git grep -l 'm_recent_rejects_reconsiderable') sed -i 's/m_recent_rejects/m_lazy_recent_rejects/g' $(git grep -l 'm_recent_rejects') -END VERIFY SCRIPT-
2024-07-31[net processing] Lazily initialize m_recent_confirmed_transactionsdergoegge
2024-07-31[net processing] Lazily initialize m_recent_rejects_reconsiderabledergoegge
2024-07-31[net processing] Lazily initialize m_recent_rejectsdergoegge
2024-07-31Merge bitcoin/bitcoin#30537: kernel: Only setup kernel context globals oncemerge-script
93fb0e7897000072ea790a91816aea876718ad27 kernel: Only setup kernel context globals once (TheCharlatan) Pull request description: The globals setup by the function calls when creating a new kernel context only need to be setup once. Calling them multiple times may be wasteful and has no apparent benefit. Besides kernel users potentially creating multiple contexts, this change may also be useful for tests creating multiple setups. ACKs for top commit: stickies-v: re-ACK 93fb0e7897000072ea790a91816aea876718ad27 maflcko: ACK 93fb0e7897000072ea790a91816aea876718ad27 👝 tdb3: re ACK 93fb0e7897000072ea790a91816aea876718ad27 Tree-SHA512: c8418c23b34883b9b6af2b93c48760a931c246c9190fae372fb808f573408d332f53ca43b9c783eef561c4a6681e2fb63f215c939b40a87d597c0518dabea22a
2024-07-30Merge bitcoin-core/gui#505: Hide peers detailsHennadii Stepanov
41a1a8615dd48fdd9811b9824c49ceb934c6375e gui: Hide peers details (@RandyMcMillan) Pull request description: Add a close (X) button to the Peers Detail panel. Reuse the same icon used in the Console Tab. The close button deselects the peer highlighted in the PeerTableView and hides the detail panel. fixes #485 Co-authored-by: @w0xlt <w0xlt@users.noreply.github.com> ACKs for top commit: pablomartin4btc: re ACK 41a1a8615dd48fdd9811b9824c49ceb934c6375e hebasto: ACK 41a1a8615dd48fdd9811b9824c49ceb934c6375e, tested on Ubuntu 23.10. Tree-SHA512: fc692891eec61bd1e6878f2433b478de3c69bf0b3ce3471f2faafda6f63d371e2cc125ae8290fd2ac3e4d8659031b79d85665318cfc5a9481e967ef99d245f9c
2024-07-30kernel: Only setup kernel context globals onceTheCharlatan
The globals setup by the function calls when creating a new kernel context only need to be setup once. Calling them multiple times may be wasteful and has no apparent benefit. Besides kernel users potentially creating multiple contexts, this change may also be useful for tests creating multiple setups. Co-authored-by: stickies-v <stickies-v@protonmail.com>
2024-07-30qt: Update translation source fileHennadii Stepanov
The diff is generated by executing `make -C src translate`.
2024-07-30qt: Pull recent translations from TransifexHennadii Stepanov
The diff is generated by executing the `update-translations.py` script. Removals of translation files have been discarded.
2024-07-29rpc: fix maybe-uninitialized compile warning in getchaintxstatsMichael Dietz
This resolves the compiler warning about potential uninitialized use of window_tx_count introduced in fa2dada.
2024-07-29Merge bitcoin-core/gui#828: Rendering an amp characters in the wallet name ↵Hennadii Stepanov
for QMenu 8233ee41ab9648cd0c3bd78bc2a8d692a54d9ea0 gui: correct replacement of amp character in the wallet name for QMenu (Konstantin Akimov) Pull request description: In the current implementation Qt uses '&' as a signal to underscore letter and use it as a hot-key, which is not expected for case of wallet name. The [comment in the code](https://github.com/bitcoin/bitcoin/pull/30446/files#diff-2ecf8cbf369cf3d2f3d2b1cf5cfe4c1a647d63e11e2885d2fd0ac11fb5f7a804L402-L404) regarding the use of an "&" on a menu item is misleading. If a wallet name has an "&" in it, it is not supposed to be interpreted as a hot-key, but it should be shown as it is without replacing it to an underscore. See screenshots before & after: ![Screenshot_20240713_122454](https://github.com/user-attachments/assets/e36d6e4c-d872-4b4c-b55e-bcfde9881281) ![Screenshot_20240713_131304](https://github.com/user-attachments/assets/9484687d-0aea-4061-a461-5d187762a4b4) ACKs for top commit: hebasto: re-ACK 8233ee41ab9648cd0c3bd78bc2a8d692a54d9ea0. pablomartin4btc: tACK 8233ee41ab9648cd0c3bd78bc2a8d692a54d9ea0 BrandonOdiwuor: ACK 8233ee41ab9648cd0c3bd78bc2a8d692a54d9ea0. Tested on Ubuntu 22.04 using Qt version 5.15.3 Tree-SHA512: 918c2c05555d203a8b203794c138651d4a1691a05a858631d5a4664b78e150402d1ae4a02ee5181f63a5b22a09badca0a4ea14a626f45f8cbe557226c308b8c5
2024-07-28Merge bitcoin/bitcoin#30515: rpc: add utxo's blockhash and number of ↵merge-script
confirmations to scantxoutset output 17845e7f219e2281cd7a51d2cfe67b22eb40c4ba rpc: add utxo's blockhash and number of confirmations to scantxoutset output (Luis Schwab) Pull request description: This PR resolves #30478 by adding two fields to the `scantxoutset` RPC: - blockhash: the blockhash that an UTXO was created - confirmations: the number of confirmations an UTXO has relative to the chaintip. The rationale for the first field is that a blockhash is a much more reliable identifier than the height: > When using the scantxoutset RPC, the current behaviour is to show the block height of the UTXO. This is not optimal, as block height is ambiguous, especially in the case of a block reorganization happening at the same instant of the query. In this case, an UTXO that does not exist would be assumed to exist, unless the chain's tip hash is recorded before the scan, and make sure it still exists after, as per https://github.com/bitcoindevkit/bdk/issues/895#issuecomment-1475766797 comment by evanlinjin. The second one was suggested by maflcko, and I agree it's useful for human users: > While touching this, another thing to add could be the number of confirmations? I understand that this wouldn't help machine consumers of the interface, but human callers may find it useful? This will yield an RPC output like so: ```diff bitcoin-cli scantxoutset start "[\"addr(bc1q5q9344vdyjkcgv79ve3tldz4jmx4lf7knmnx6r)\"]" { "success": true, "txouts": 185259116, "height": 853622, "bestblock": "00000000000000000002e97d9be8f0ddf31829cf873061b938c10b0f80f708b2", "unspents": [ { "txid": "fae435084345fe26e464994aebc6544875bca0b897bf4ce52a65901ae28ace92", "vout": 0, "scriptPubKey": "0014a00b1ad58d24ad8433c56662bfb45596cd5fa7d6", "desc": "addr(bc1q5q9344vdyjkcgv79ve3tldz4jmx4lf7knmnx6r)#smk4xmt7", "amount": 0.00091190, "coinbase": false, "height": 852741, + "blockhash": "00000000000000000002eefe7e7db44d5619c3dace4c65f3fdcd2913d4945c13", + "confirmations": 882 } ], "total_amount": 0.00091190 } ``` ACKs for top commit: sipa: utACK 17845e7f219e2281cd7a51d2cfe67b22eb40c4ba Eunovo: ACK https://github.com/bitcoin/bitcoin/pull/30515/commits/17845e7f219e2281cd7a51d2cfe67b22eb40c4ba tdb3: ACK 17845e7f219e2281cd7a51d2cfe67b22eb40c4ba Tree-SHA512: 02366d0004e5d547522115ef0efe6794a35978db53dda12c675cfae38197bf43f0bf89ca99a3d79e3d2cff95186015fe1ab764abb8ab82bda440ae9302ad973b
2024-07-27rpc: add utxo's blockhash and number of confirmations to scantxoutset outputLuis Schwab
2024-07-26Merge bitcoin/bitcoin#30386: Early logging improvementsRyan Ofsky
b4dd7ab43e8cfc2c171f67588e4e1ec2705393c2 logging: use std::string_view (Anthony Towns) 558df5c733d31456faf856d44f7037f41981d797 logging: Apply formatting to early log messages (Anthony Towns) 6cf9b344409efcc41a2b34f87100d25e1d2486af logging: Limit early logging buffer (Anthony Towns) 0b1960f1b29cfe5209ac68102c8643fc9553f247 logging: Add DisableLogging() (Anthony Towns) 6bbc2dd6c50f09ff1e70423dc29a404b570f5b69 logging: Add thread safety annotations (Anthony Towns) Pull request description: In order to cope gracefully with `Log*()` calls that are invoked prior to logging being fully configured (indicated by calling `StartLogging()` we buffer early log messages in `m_msgs_before_open`. This has a couple of minor issues: * if there are many such log messages the buffer can become arbitrarily large; this can be a problem for users of libkernel that might not wish to worry about logging at all, and as a result never invoke `StartLogging()` * early log messages are formatted before the formatting options are configured, leading to inconsistent output Fix those issues by buffering the log info prior to formatting it, and setting a limit on the size of the buffer (dropping the oldest lines, and reporting the number of lines skipped). Also adds some thread safety annotations, and the ability to invoke `LogInstance().DisableLogging()` if you want to disable logging entirely, for a minor efficiency improvement. ACKs for top commit: maflcko: re-ACK b4dd7ab43e8cfc2c171f67588e4e1ec2705393c2 🕴 ryanofsky: Code review ACK b4dd7ab43e8cfc2c171f67588e4e1ec2705393c2 TheCharlatan: Nice, ACK b4dd7ab43e8cfc2c171f67588e4e1ec2705393c2 Tree-SHA512: 966660181276939225a9f776de6ee0665e44577d2ee9cc76b06c8937297217482e6e426bdc5772d1ce533a0ba093a8556b6a50857d4c876ad8923e432a200440
2024-07-26Merge bitcoin/bitcoin#30447: fuzz: Deglobalize signature cache in sigcache testRyan Ofsky
fae0db0360466aed536f4ce96d357cf579100080 fuzz: Deglobalize signature cache in sigcache test (TheCharlatan) Pull request description: The body of the fuzz test should ideally be a pure function. If data is persisted in the cache over many iterations, and there is a crash, reproducing it from the input might be difficult. Solve this by getting rid of the global state. This is a follow-up from #30425. ACKs for top commit: dergoegge: utACK fae0db0360466aed536f4ce96d357cf579100080 ryanofsky: Code review ACK fae0db0360466aed536f4ce96d357cf579100080 Tree-SHA512: 93dcbb9f2497f13856970469042d6870f04de10fe206827a8db1aae7fc8f3ac7fd900bee7945b5fe4c9e33883268dabb15be7e7bc91cf353ffc0d118cd60e97d
2024-07-26Merge bitcoin/bitcoin#30126: cluster mempool: cluster linearization algorithmglozow
647fa37cdbadbeebba147ca6b24e138559cffaaf bench: add cluster linearization improvement benchmark (Pieter Wuille) 28549791b3802fc078128f552c6f53ac3de893a6 clusterlin: permit passing in existing linearization to Linearize (Pieter Wuille) 97d98718b005adc0bdf513d724874601d8aa13ad clusterlin: add LinearizationChunking class (Pieter Wuille) d5918dc3c6d9480c8a5e295db0f4d4892b0138f6 clusterlin: randomize the SearchCandidateFinder search order (Pieter Wuille) 991ff9a9a4f2171ab99cb0ca1d70ebbc0db9d388 clusterlin: use bounded BFS exploration (optimization) (Pieter Wuille) d9b235e7d288814e8ee248b68d91eb68866b32bd bench: Candidate finding and linearization benchmarks (Pieter Wuille) 46aad9b09986feb1d54fc4229a0d224da94fb80a clusterlin: add Linearize function (Pieter Wuille) ee0ddfe4f626bfb4b58927db89d317cb3531813f clusterlin: add chunking algorithm (Pieter Wuille) 2a41f151afb82466486402e250327e22319c754e clusterlin: add SearchCandidateFinder class (Pieter Wuille) 4828079db327bf2aeaed744843a415d1654e8796 clusterlin: add AncestorCandidateFinder class (Pieter Wuille) 58f7e01db4bad6d958d44f2bcdfd9df9e22931a4 tests: framework for testing DepGraph class (Pieter Wuille) a6e07e769a1af652a14e533f6d3558ccdefb1de5 clusterlin: introduce cluster_linearize.h with Cluster and DepGraph types (Pieter Wuille) Pull request description: Part of cluster mempool: #30289 This introduces low-level cluster linearization code, including tests and some benchmarks. It is currently not hooked up to anything. Ultimately, what this PR adds is a function `Linearize` which operates on instances of `DepGraph` (instances of which represent pre-processed transaction clusters) to produce and/or improve linearizations for that cluster. To provide assurance, the code heavily relies on fuzz tests. A novel approach is used here, where the fuzz input is parsed using the serialization.h framework rather than `FuzzedDataProvider`, with a custom serializer/deserializer for `DepGraph` objects. By including serialization, it's possible to ascertain that the format can represent every relevant cluster, as well as potentially permitting the construction of ad-hoc fuzz inputs from clusters (not included in this PR, but used during development). --- The `Linearize(depgraph, iteration_limit, rng_seed, old_linearization)` function is an implementation of the (single) LIMO algorithm, with the $S$ in every iteration found as the best out of (a) the best remaining ancestor set and (b) randomized computationally-bounded search. It incrementally builds up a linearization by finding good topologically-valid subsets to move to the front, in such a way that the resulting linearization has a diagram that is at least as good as the `old_linearization` passed in (if any). * Despite using both best ancestor set and search, this is not Double LIMO, as no intersections between these are involved; just the best of the two. * The `iteration_limit` and `rng_seed` only control the (b) randomized search. Even with 0 iterations, the result will be as good as the old linearization, and the included sets at every point will have a feerate at least as high as the best remaining ancestor set at that point. The search algorithm used in the (b) step is very basic, and largely matches Section 2.1 of [How to Linearize your Cluster.](https://delvingbitcoin.org/t/how-to-linearize-your-cluster/303#h-21-searching-6). See #30286 for optimizations to make it more efficient. For background and references, see [Introduction to cluster linearization](https://delvingbitcoin.org/t/introduction-to-cluster-linearization/1032). ACKs for top commit: instagibbs: reACK 647fa37cdbadbeebba147ca6b24e138559cffaaf glozow: reACK 647fa37cdba, both code and mermaid diagram look correct to me sdaftuar: ACK 647fa37cdbadbeebba147ca6b24e138559cffaaf Tree-SHA512: 52c8aa3d1d91190bf1265a947d2712e9d12f745313ffceef6ae7e3ff517d01d8b3b9b4ce6066298d59751c4ba90555a3c0171229868ba50100f588a2aa6a486d
2024-07-26Merge bitcoin/bitcoin#30517: refactor: Add FlatFileSeq member variables in ↵merge-script
BlockManager 7aa8994c6fceae5cf8fb7e661371cdb19d2cb482 refactor: Add FlatFileSeq member variables in BlockManager (TheCharlatan) Pull request description: Instead of constructing a new class every time a file operation is done, construct them once for each of the undo and block file when a new BlockManager is created. In future, this might make it easier to introduce an abstract block store. Historically, this was not easily possible prior to #27125. ACKs for top commit: danielabrozzoni: ACK 7aa8994c6fceae5cf8fb7e661371cdb19d2cb482 tdb3: ACK 7aa8994c6fceae5cf8fb7e661371cdb19d2cb482 stickies-v: ACK 7aa8994c6fceae5cf8fb7e661371cdb19d2cb482 brunoerg: utACK 7aa8994c6fceae5cf8fb7e661371cdb19d2cb482 Tree-SHA512: 7c181968c270956c90fa0f3687562239912a973b6a35ddbf49fc58733247ea9d986303cbf6f8fc16e8c2d9bf4505e866aed37f030a8c9be72e95bf3752902aa6
2024-07-26Merge bitcoin/bitcoin#26950: cleanse: switch to SecureZeroMemory for Windows ↵merge-script
cross-compile c399c80a09a393d38368a44ef04753e9f62350f0 cleanse: Use SecureZeroMemory for mingw-w64 (release) builds (fanquake) Pull request description: This PR switches our Windows release builds to use the [`SecureZeroMemory()`](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/aa366877(v=vs.85)) provided by mingw-w64. ACKs for top commit: sipa: utACK c399c80a09a393d38368a44ef04753e9f62350f0 TheCharlatan: ACK c399c80a09a393d38368a44ef04753e9f62350f0 Tree-SHA512: dbb20b16c85061d2f9408a3cf69cecc16765f8f61b25a1707146767b664c7ad0caf36975380814ef8e7c49a30199daebac6d5d7a3585354d1adac8e9770199c6
2024-07-25bench: add cluster linearization improvement benchmarkPieter Wuille
2024-07-25clusterlin: permit passing in existing linearization to LinearizePieter Wuille
This implements the LIMO algorithm for linearizing by improving an existing linearization. See https://delvingbitcoin.org/t/limo-combining-the-best-parts-of-linearization-search-and-merging for details.
2024-07-25clusterlin: add LinearizationChunking classPieter Wuille
It encapsulates a given linearization in chunked form, permitting arbitrary subsets of transactions to be removed from the linearization. Its purpose is adding the Intersect function, which is a crucial operation that will be used in a further commit to make Linearize improve existing linearizations.
2024-07-25clusterlin: randomize the SearchCandidateFinder search orderPieter Wuille
To make search non-deterministic, change the BFS logic from always picking the first queue item to randomly picking the first or second queue item.
2024-07-25clusterlin: use bounded BFS exploration (optimization)Pieter Wuille
Switch to BFS exploration of the search tree in SearchCandidateFinder instead of DFS exploration. This appears to behave better for real world clusters. As BFS has the downside of needing far larger search queues, switch back to DFS temporarily when the queue grows too large.
2024-07-25bench: Candidate finding and linearization benchmarksPieter Wuille
Add benchmarks for known bad graphs for the purpose of search (as an upper bound on work per search iterations) and ancestor sorting (as an upper bound on linearization work with no search iterations).
2024-07-25clusterlin: add Linearize functionPieter Wuille
This adds a first version of the overall linearization interface, which given a DepGraph constructs a good linearization, by incrementally including good candidate sets (found using AncestorCandidateFinder and SearchCandidateFinder).
2024-07-25clusterlin: add chunking algorithmPieter Wuille
A fuzz test is added which verifies various of its expected properties, including correctness
2024-07-25clusterlin: add SearchCandidateFinder classPieter Wuille
Similar to AncestorCandidateFinder, this encapsulates the state needed for finding good candidate sets using a search algorithm.
2024-07-25clusterlin: add AncestorCandidateFinder classPieter Wuille
This is a class that encapsulates precomputed ancestor set feerates, and presents an interface for getting the best remaining ancestor set.
2024-07-25tests: framework for testing DepGraph classPieter Wuille
This introduces a bespoke fuzzing-focused serialization format for DepGraphs, and then tests that this format can represent any graph, roundtrips, and then uses that to test the correctness of DepGraph itself. This forms the basis for future fuzz tests that need to work with interesting graphs.
2024-07-25clusterlin: introduce cluster_linearize.h with Cluster and DepGraph typesPieter Wuille
This primarily adds the DepGraph class, which encapsulates precomputed ancestor/descendant information for a given transaction cluster, with a number of utility features (inspectors for set feerates, computing reduced parents/children, adding transactions, adding dependencies), which will become needed in future commits.
2024-07-25Merge bitcoin/bitcoin#30507: m_tx_download_mutex followupsmerge-script
7c29e556c573a63351096c34bc072ae0c60ffa29 m_tx_download_mutex followups (glozow) e543c657dad830294609424b459755884bd44f3c release m_tx_download_mutex before MakeAndPushMessage GETDATA (glozow) bce5f37c7bef2755e8d5f0886f37dd58357dadad [refactor] change ActiveTipChange to use CBlockIndex ref instead of ptr (glozow) 7cc5ac5a674f31af2ac7e5b5842e1c1aeb9e6744 [doc] TxOrphanage is no longer thread-safe (glozow) 6f49548670d5ab12a963c0ada3b315c544b95e2e [refactor] combine block vtx loops in BlockConnected (glozow) Pull request description: Followup to #30111. Includes suggestions: - https://github.com/bitcoin/bitcoin/pull/30111#discussion_r1686303768 - https://github.com/bitcoin/bitcoin/pull/30111#discussion_r1686314984 - https://github.com/bitcoin/bitcoin/pull/30111#discussion_r1683186792 - https://github.com/bitcoin/bitcoin/pull/30111#issuecomment-2242819514 - https://github.com/bitcoin/bitcoin/pull/30111#discussion_r1686372826 ACKs for top commit: instagibbs: reACK https://github.com/bitcoin/bitcoin/pull/30507/commits/7c29e556c573a63351096c34bc072ae0c60ffa29 theStack: re-ACK 7c29e556c573a63351096c34bc072ae0c60ffa29 dergoegge: reACK 7c29e556c573a63351096c34bc072ae0c60ffa29 Tree-SHA512: 79a9002d74739367789bbc64bb1d431f4d43a25a7934231e55814c2cb6981c15ef2d8465544ae2a4fbd734d9bed6cc41b37a923938a88cb8fea139523c1e98da
2024-07-25Merge bitcoin/bitcoin#30399: test: Add arguments for creating a slimmer ↵merge-script
TestingSetup f46b2202560a76b473e229b77303b8f877c16cac fuzz: Use BasicTestingSetup for coins_view target (TheCharlatan) 9e2a723d5da4fc277a42fed37424f578e348ebf8 test: Add arguments for creating a slimmer setup (TheCharlatan) Pull request description: This adds arguments to some of the testing setup constructors for creating an environment without networking and a validation interface. This is useful for improving the performance of the utxo snapshot fuzz test, which constructs a new TestingSetup on each iteration. Using this slimmed down `TestingSetup` in future might also make the tests a bit faster when run in aggregate. ACKs for top commit: maflcko: review ACK f46b2202560a76b473e229b77303b8f877c16cac dergoegge: utACK f46b2202560a76b473e229b77303b8f877c16cac Tree-SHA512: 9dc62512b127b781fc9e2d8ef2b5a9b06ebb927a8294b6d872001c553984a7eb1f348e0257b32435b34b5505b5d0323f73bdd572a673da272d3e1e8538ab49d6
2024-07-25Merge bitcoin/bitcoin#30482: rest: Reject truncated hex txid early in ↵merge-script
getutxos parsing fac0c3d4bfc97b94f0594f7606650921feef2c8a doc: Add release notes for two pull requests (MarcoFalke) fa7b57e5f5a6dafbbadc361ffd27b58afff1ed59 refactor: Replace ParseHashStr with FromHex (MarcoFalke) fa9077724507faad207f29509a8202fc6ac9d502 rest: Reject truncated hex txid early in getutxos parsing (MarcoFalke) fab6ddbee64e50d5e2f499aebca35b5911896ec4 refactor: Expose FromHex in transaction_identifier (MarcoFalke) fad2991ba073de0bd1f12e42bf0fbaca4a265508 refactor: Implement strict uint256::FromHex() (MarcoFalke) fa103db2bb736bce4440f0bde564e6671e36311d scripted-diff: Rename SetHex to SetHexDeprecated (MarcoFalke) fafe4b80512a5a82712a3ee81b68cfeb21271dee test: refactor: Replace SetHex with uint256 constructor directly (MarcoFalke) Pull request description: In `rest_getutxos` truncated txids such as `aa` or `ff` are accepted. This is brittle at best. Fix it by rejecting any truncated (or overlarge) input. ---- Review note: This also starts a major refactor to rework hex parsing in Bitcoin Core, meaning that a few refactor commits are included as well. They are explained individually in the commit message and the work will be continued in the future. ACKs for top commit: stickies-v: re-ACK fac0c3d4bfc97b94f0594f7606650921feef2c8a - only doc and test updates to address review comments, thanks! hodlinator: ACK fac0c3d4bfc97b94f0594f7606650921feef2c8a Tree-SHA512: 473feb3fcf6118443435d1dd321006135b0b54689bfbbcb1697bb5811a449bef51f475c715de6911ff3c4ea3bdb75f601861ff93347bc4414d6b9e5298105dd7
2024-07-25m_tx_download_mutex followupsglozow
- add AssertLockNotHeld(m_tx_download_mutex) in net_processing - move doc about m_tx_download_mutex and mempool mutex to ActiveTipChange