aboutsummaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2021-12-01Merge bitcoin/bitcoin#23546: scripted-diff: Use clang-tidy syntax for C++ ↵fanquake
named arguments (tests only) fa00447442f22a24e5ca5fc538d0bf7bef575544 scripted-diff: Use clang-tidy syntax for C++ named arguments (MarcoFalke) fae13c39896898aef2281433af143c22d8b3a3b4 doc: Use clang-tidy comments in crypto_tests (MarcoFalke) Pull request description: Incorrect named args are source of bugs, like #22979. To allow them being checked by `clang-tidy`, use a format it can understand. ACKs for top commit: shaavan: ACK fa00447442f22a24e5ca5fc538d0bf7bef575544 rajarshimaitra: ACK https://github.com/bitcoin/bitcoin/pull/23546/commits/fa00447442f22a24e5ca5fc538d0bf7bef575544 jonatack: ACK fa00447442f22a24e5ca5fc538d0bf7bef575544 fanquake: ACK fa00447442f22a24e5ca5fc538d0bf7bef575544 Tree-SHA512: 4d23a8363da81dfea21a4cd8516ab5e0dc70119e4d503f3f240f38573218b2c2e84083b97e956c62942d78b2f17490f8b3b2e8077d257644fda1d901e2b80507
2021-11-26Merge bitcoin/bitcoin#23517: scripted-diff: Move miner to src/nodeMarcoFalke
fa4e09924b11b0dc94e377005f86a83c09761265 refactor: Replace validation.h include with forward-decl in miner.h (MarcoFalke) fa0739a7d398aea952a07b73ef565e7c2da75898 style: Sort file list after rename (MarcoFalke) fa53e3a58c94731a90514fe92fad365a49adb10c scripted-diff: Move miner to src/node (MarcoFalke) Pull request description: It is impossible to run the miner without a node (validation, chainstate, mempool, rpc, ...). Also, the module is in the node library. Thus, it should be moved to `src/node`. Also, replace the `validation.h` include in the header with a forward-declaration. ACKs for top commit: theStack: Code-review ACK fa4e09924b11b0dc94e377005f86a83c09761265 Tree-SHA512: 791e6caa5839d8dc83b0f58f3f49bc0a7e3c1710822e8a44dede254c87b6f7531a0586fb95e8a067c181457a3895ad6041718aa2a2fac64cfc136bf04bb851d5
2021-11-25Merge bitcoin/bitcoin#22829: refactor: various RecursiveMutex replacements ↵MarcoFalke
in CConnman 3726a4595837b66d37f151faf1cec2796d6b74d7 refactor: replace RecursiveMutex m_added_nodes_mutex with Mutex (Sebastian Falbesoner) 7d52ff5c389643cde613d86fee33d7087f47b8b4 refactor: replace RecursiveMutex m_addr_fetches_mutex with Mutex (Sebastian Falbesoner) d51d2a3bb5b0011efa1b4f1e2c9512a16ce9b347 scripted-diff: rename node vector/mutex members in CConnman (Sebastian Falbesoner) 574cc4271ab09a4c8f8d076cb1a3a2d5b3924b73 refactor: remove RecursiveMutex cs_totalBytesRecv, use std::atomic instead (Sebastian Falbesoner) Pull request description: This PR is related to #19303 and gets rid of the following RecursiveMutex members in class `CConnman`: * for `cs_totalBytesRecv`, protecting `nTotalBytesRecv`, `std::atomic` is used instead (the member is only increment at one and read at another place, so this is sufficient) * for `m_addr_fetches_mutex`, protecting `m_addr_fetches`, a regular `Mutex` is used instead (there is no chance that within one critical section, another one is called) * for `cs_vAddedNodes`, protecting `vAddedNodes`, a regular `Mutex` is used instead (there is no chance that within one critical section, another one is called) Additionally, the PR takes the chance to rename all node vector members (vNodes, vAddedNodes) and its corresponding mutexes (cs_vNodes, cs_vAddedNodes) to match the coding guidelines via a scripted-diff. ACKs for top commit: vasild: ACK 3726a4595837b66d37f151faf1cec2796d6b74d7 promag: Code review ACK 3726a4595837b66d37f151faf1cec2796d6b74d7. hebasto: re-ACK 3726a4595837b66d37f151faf1cec2796d6b74d7 Tree-SHA512: 4f5ad41ba2eca397795080988c1739c6abb44c1204dddaa75cc38a396fa821fbe1010694ba7bead1b606beaa677661e66da2a5dca233b2937214f63a54848348
2021-11-25Merge bitcoin/bitcoin#23512: policy: Treat taproot as always activeMarcoFalke
fa3e0da06b491b8c0fa2dbae37682a9112c9deb8 policy: Treat taproot as always active (MarcoFalke) Pull request description: Now that taproot is active, it can be treated as if it was always active for policy for the next major release. This simplifies the code and changes two things: * Importing `tr` descriptors can be done before the chain is fully synced. This is fine, because the wallet will already generate `tr` descriptors by default (regardless of the taproot status) after commit 47fe7445e7f54aee10ec6dbc53f1db1adbeb43de. * Valid taproot spends won't be rejected from the mempool before taproot is active. This is strictly speaking a bugfix after commit 47fe7445e7f54aee10ec6dbc53f1db1adbeb43de, since the wallet may generate taproot spends before the chain is fully synced. For example, a slow node or a purposefully offline node. Currently, the wallet needs the mempool to account for change. See https://github.com/bitcoin/bitcoin/issues/11887. A similar change was done for segwit v0 in https://github.com/bitcoin/bitcoin/pull/13120 . This effectively reverts commit c5ec0367d718544caa3a1578d6c730fc92ee4e94. ACKs for top commit: mjdietzx: Code Review ACK fa3e0da06b491b8c0fa2dbae37682a9112c9deb8 achow101: ACK fa3e0da06b491b8c0fa2dbae37682a9112c9deb8 sipa: utACK fa3e0da06b491b8c0fa2dbae37682a9112c9deb8 gruve-p: ACK https://github.com/bitcoin/bitcoin/pull/23512/commits/fa3e0da06b491b8c0fa2dbae37682a9112c9deb8 gunar: Code Review + tACK fa3e0da06 rajarshimaitra: code review + tACK https://github.com/bitcoin/bitcoin/pull/23512/commits/fa3e0da06b491b8c0fa2dbae37682a9112c9deb8 Tree-SHA512: c6dc7a4e6c345bdec33f256847dc63906ab1696aa683ab9b32a79e715613950884ac3a1a7a44e95f31bb28e58dd64679a616175f7e152b21f5550f3337c8e622
2021-11-24scripted-diff: rename node vector/mutex members in CConnmanSebastian Falbesoner
-BEGIN VERIFY SCRIPT- ren() { sed -i "s/$1/$2/g" $3 $4 $5; } ren cs_vAddedNodes m_added_nodes_mutex src/net.h src/net.cpp ren vAddedNodes m_added_nodes src/net.h src/net.cpp ren cs_vNodes m_nodes_mutex src/net.h src/net.cpp src/test/util/net.h ren vNodesDisconnectedCopy nodes_disconnected_copy src/net.cpp ren vNodesDisconnected m_nodes_disconnected src/net.h src/net.cpp ren vNodesCopy nodes_copy src/net.cpp ren vNodesSize nodes_size src/net.cpp ren vNodes m_nodes src/net.h src/net.cpp src/test/util/net.h -END VERIFY SCRIPT-
2021-11-24Merge bitcoin/bitcoin#23451: span: Add std::byte helpersMarcoFalke
faa3ec2304051be7cfbe301cfbfbda3faf7514fc span: Add std::byte helpers (MarcoFalke) fa18038f519db76befb9a7bd0b1540143bfeb12b refactor: Use ignore helper when unserializing an invalid pubkey (MarcoFalke) fabe18d0b39b4b918bf60e3a313eaa36fb4067f2 Use value_type in CDataStream where possible (MarcoFalke) Pull request description: This adds (currently unused) span std::byte helpers, so that they can be used in new code. The refactors are also required for https://github.com/bitcoin/bitcoin/pull/23438, but they are split up because the other pull doesn't compile with msvc right now. The third commit is not needed for the other pull, but still nice. ACKs for top commit: klementtan: reACK faa3ec2. Verified that all the new `std::byte` helper functions are tested. laanwj: Code review ACK faa3ec2304051be7cfbe301cfbfbda3faf7514fc Tree-SHA512: b1f6af39f03ea4dfebf20d4a8538fa993a6104e7fc92ddf0c4606a7efc3ca9a8c1a4741d98a1418569c11bb9ce9258bf0c0c06d93d85ed7e208902a2db04e407
2021-11-24Merge bitcoin/bitcoin#23249: util: ParseByteUnits - Parse a string with ↵MarcoFalke
suffix unit 21b58f430fa05fdb7c5db79b545302417a5dbceb util: ParseByteUnits - Parse a string with suffix unit [k|K|m|M|g|G|t|T] (Douglas Chimento) Pull request description: A convenience utility for parsing human readable strings sizes e.g. `500G` is `500 * 1 << 30` The argument/setting `maxuploadtarget` now accept human readable byte units `[k|K|m|M|g|G||t|T]` This change backward compatible, defaults to `M` if no unit specified. ACKs for top commit: vasild: ACK 21b58f430fa05fdb7c5db79b545302417a5dbceb ryanofsky: Code review ACK 21b58f430fa05fdb7c5db79b545302417a5dbceb. Only changes since last review are dropping optional has_value call, fixing comment punctuation, squashing commits. Tree-SHA512: c9b85acc0f77c847a0290b27ac5dc586ecc078110cf133063140576a04c11aa9c553159b9b4993488edcf6e60db6837de7c83b2964639bc21e8ffa4d455a5eb7
2021-11-22Merge bitcoin/bitcoin#16807: Let validateaddress locate error in Bech32 addressW. J. van der Laan
88cc4810926e4f5af6757ee1b0eed61abda3d746 Modify copyright header on Bech32 code (Samuel Dobson) 5599813b80e53a1539c66625b4320ab1b4fb4848 Add lots of comments to Bech32 (Samuel Dobson) 2eb5792ec7bbeaf7138420b6c85c5cd0a0404946 Add release notes for validateaddress Bech32 error detection (MeshCollider) 42d6a029e57a32f2d1d829ff7718b6d40d58b9d1 Refactor and add more tests for validateaddress (Samuel Dobson) c4979f77c1264f0099d1dfa278b1d9c18340b5f9 Add boost tests for bech32 error detection (MeshCollider) 02a7bdee429ae307a5e57832727fed789e2e04fb Add error_locations to validateaddress RPC (Samuel Dobson) b62b67e06cc406fdad68da4c091168fb5f11c1d4 Add Bech32 error location function (Samuel Dobson) 0b06e720c0182dee8b560d2e8d3891b036f63ea7 More detailed error checking for base58 addresses (Samuel Dobson) Pull request description: Addresses (partially) #16779 - no GUI change in this PR Adds a LocateError function the bech32 library, which is then called by `validateaddress` RPC, (and then eventually from a GUI tool too, future work). I think modifying validateaddress is nicer than adding a separate RPC for this. Includes tests. Based on https://github.com/sipa/bech32/blob/master/ecc/javascript/bech32_ecc.js Credit to sipa for that code ACKs for top commit: laanwj: Code review and manually tested ACK 88cc4810926e4f5af6757ee1b0eed61abda3d746 ryanofsky: Code review ACK 88cc4810926e4f5af6757ee1b0eed61abda3d746 with caveat that I only checked the new `LocateErrors` code to try to verify it didn't have unsafe or unexpected operations or loop forever or crash. Did not try to verify behavior corresponds to the spec. In the worst case bugs here should just affect error messages not actual decoding of addresses so this seemed ok. w0xlt: tACK 88cc481 Tree-SHA512: 9c7fe9745bc7527f80a30bd4c1e3034e16b96a02cc7f6c268f91bfad08a6965a8064fe44230aa3f87e4fa3c938f662ff4446bc682c83cb48c1a3f95cf4186688
2021-11-19scripted-diff: Use clang-tidy syntax for C++ named argumentsMarcoFalke
-BEGIN VERIFY SCRIPT- perl -0777 -pi -e 's:((\(|\{|,)(\n| )*)\/\* ?([^=* ]+) ?\*\/ ?:\1/*\4=*/:g' $( git ls-files ./src/test ./src/wallet/test ) -END VERIFY SCRIPT-
2021-11-19doc: Use clang-tidy comments in crypto_testsMarcoFalke
Also, fix argument name for FastRandomContext.
2021-11-17util: ParseByteUnits - Parse a string with suffix unit [k|K|m|M|g|G|t|T]Douglas Chimento
A convenience utility for human readable arguments/config e.g. -maxuploadtarget=500g
2021-11-17doc: Fix incorrect C++ named argsMarcoFalke
2021-11-17Merge bitcoin/bitcoin#23496: fuzz: Add minisketch fuzz testMarcoFalke
fa74d4530615cfa02cf32a16fab6b13908266e6f fuzz: Add minisketch fuzz test (MarcoFalke) Pull request description: ACKs for top commit: mjdietzx: re-ACK fa74d45 sipa: utACK fa74d4530615cfa02cf32a16fab6b13908266e6f Tree-SHA512: 3d30095c85032139c37c7a2811dd417441a5105cb70af8250000d7b56aeda1e8fab5e65e683fb49d513ef40a81da3967a8a9a70caf40f56cef1dd96c6d4a05f6
2021-11-16fuzz: Add minisketch fuzz testMarcoFalke
2021-11-16style: Sort file list after renameMarcoFalke
2021-11-16scripted-diff: Move miner to src/nodeMarcoFalke
-BEGIN VERIFY SCRIPT- # Move module git mv src/miner.cpp src/node/ git mv src/miner.h src/node/ # Replacements sed -i 's:miner\.h:node/miner.h:g' $(git grep -l miner) sed -i 's:miner\.cpp:node/miner.cpp:g' $(git grep -l miner) sed -i 's:MINER_H:NODE_MINER_H:g' $(git grep -l MINER_H) -END VERIFY SCRIPT-
2021-11-16doc: Fix typos in endif header commentsMarcoFalke
2021-11-16Merge bitcoin/bitcoin#23491: scripted-diff: Move minisketchwrapper to src/nodefanquake
faba1abe469833b2dad01bac4e4d8a4ebb4bc97a Sort file list after rename (MarcoFalke) fa8f60e31102e1153ad1452fbced51e54487a3d4 scripted-diff: Move minisketchwrapper to src/node (MarcoFalke) Pull request description: The newly added wrapper is currently in the node library, but not placed in the node directory. While it is possible to use the wrapper outside of a node context (for example in a utility), it seems unlikely. Either way, I think the wrapper should either be moved to the util lib+dir or the node lib+dir, not something in-between. Also, fix incorrect comment `BITCOIN_DBWRAPPER_H`. ACKs for top commit: fanquake: ACK faba1abe469833b2dad01bac4e4d8a4ebb4bc97a. I saw the comment in #21515, however given there hasn't been any new activity there, I'm going to merge this now. Tree-SHA512: fccc0cfd1fee661152a1378587b96795ffb7a7eceb6d2c27ea5401993fd8b9c0a92579fdba61203917ae6565269cb28d0973464fb6201dabf72a5143495d3e77
2021-11-16policy: Treat taproot as always activeMarcoFalke
2021-11-15Merge bitcoin/bitcoin#23394: Taproot wallet test vectors (generation+tests)W. J. van der Laan
f1c33ee4ac1056289f2e67b75755388549ada4ca tests: implement BIP341 test vectors (Pieter Wuille) ac3037df1196b1d95ade2dfad4699ad3a6074903 tests: BIP341 test vector generation (Pieter Wuille) ca83ffc2ea5fe08f16fff7df71c040d067f2afb0 tests: add deterministic signing mode to ECDSA (Pieter Wuille) c98c53f20cadeda53f6a9323f72363593d174f68 tests: abstract out precomputed BIP341 signature hash elements (Pieter Wuille) a5bde018b42cd38979fee71d870e0140b10c73d6 tests: give feature_taproot access to sighash preimages (Pieter Wuille) 51408250969e7ed171378369a995c90d4f813189 tests: add more fields to TaprootInfo (Pieter Wuille) 2478c6730a81dda3c56cb99087caf6abe49c85f5 Make signing follow BIP340 exactly w.r.t. aux randomness (Pieter Wuille) Pull request description: This PR adds code to `test/functional/feature_taproot.py` which runs through a (deterministic) scenario covering several aspects of the wallet side of BIP341 (scriptPubKey computation from keys/scripts, control block computation, key path spending), with the ability to output test vectors in mediawiki format based on this scenario. The generated tests are then also included directly in `src/test/script_tests.cpp` and `src/test/script_standard_tests.cpp`. I intend to add these test vectors to BIP341 itself: https://github.com/bitcoin/bips/pull/1225 ACKs for top commit: laanwj: Code review ACK f1c33ee4ac1056289f2e67b75755388549ada4ca Tree-SHA512: fcf7109539cb214d3190516b205cd32d2b1b452f14aa66f4107acfaa8bfc7d368f626857f1935665a4342eabc0b9ee8aba608a7c0a2494bec0b498e723439c9d
2021-11-15Merge bitcoin/bitcoin#23408: fuzz: Rework ConsumeScriptMarcoFalke
fa4baf0756c792630391ed456aaa15285ad6eb52 fuzz: Rework ConsumeScript (MarcoFalke) Pull request description: This should make it easier for the fuzz engine to explore multisig code paths. See discussion in https://github.com/bitcoin/bitcoin/issues/23105 The downside is that all fuzz inputs that use ConsumeScript are now invalidated and need to be re-generated. Another downside may be that most multisig scripts from ConsumeScript are using likely not fully valid pubkeys. ACKs for top commit: jamesob: ACK https://github.com/bitcoin/bitcoin/pull/23408/commits/fa4baf0756c792630391ed456aaa15285ad6eb52 Tree-SHA512: 15814afdee76b05ff7a71c0f07bbd1b3cff30d709d5c1e68fd230c5f5d16e673e42709a4fab84d4a896bc27f972f917fe7c1d1b32c2bf4209658b18da97e478b
2021-11-15Merge bitcoin/bitcoin#22508: fuzz: replace every fuzzer-controlled while ↵MarcoFalke
loop with a macro 214d9055acdd72189a2f415477ce472ca8db4191 fuzz: replace every fuzzer-controlled loop with a LIMITED_WHILE loop (Andrew Poelstra) Pull request description: Limits the number of iterations to 1000 rather than letting the fuzzer do millions or billions of iterations on a single core. ACKs for top commit: MarcoFalke: cr ACK 214d9055acdd72189a2f415477ce472ca8db4191 Tree-SHA512: 9741c32ccd126ea656e5c93371b7136eaa2f92dc9a490dd4d39642503b1a41174f3368245153e508c3b608fe37ab89800b67ada97b740e3b5a3728bb506429d3
2021-11-12fuzz: replace every fuzzer-controlled loop with a LIMITED_WHILE loopAndrew Poelstra
Blindly chose a cap of 10000 iterations for every loop, except for the two in script_ops.cpp and scriptnum_ops.cpp which appeared to (sometimes) be deserializing individual bytes; capped those to one million to ensure that sometimes we try working with massive scripts. There was also one fuzzer-controlled loop in timedata.cpp which was already capped, so I left that alone. git grep 'while (fuzz' should now run clean except for timedata.cpp
2021-11-12tests: implement BIP341 test vectorsPieter Wuille
2021-11-12Make signing follow BIP340 exactly w.r.t. aux randomnessPieter Wuille
libsecp256k1's secp256k1_schnorrsig_sign only follows BIP340 exactly if an aux_rand32 argument is passed. When no randomness is used (as is the case in the current codebase here), there is no impact on security between not providing aux_rand32 at all, or providing an empty one. Yet, for repeatability/testability it is simpler to always use an all-zero one.
2021-11-12style: Use 4 spaces for indentation, not 5MarcoFalke
The wrong indentation breaks editor workflows. Can be reviewed with --ignore-all-space
2021-11-12test: Remove unused CDataStream copyMarcoFalke
2021-11-12scripted-diff: Move minisketchwrapper to src/nodeMarcoFalke
-BEGIN VERIFY SCRIPT- # Move module git mv src/minisketchwrapper.cpp src/node/ git mv src/minisketchwrapper.h src/node/ # Replacements sed -i 's:minisketchwrapper:node/minisketchwrapper:g' $(git grep -l minisketchwrapper) sed -i 's:MINISKETCHWRAPPER_H:NODE_MINISKETCHWRAPPER_H:g' $(git grep -l MINISKETCHWRAPPER_H) sed -i 's:DBWRAPPER_H:NODE_MINISKETCHWRAPPER_H:g' ./src/node/minisketchwrapper.h -END VERIFY SCRIPT-
2021-11-12Merge bitcoin/bitcoin#23477: addrman: tidy up unit testsMarcoFalke
36d3510303875c9f98eb00b28763c7c043d4dcee [addrman] [tests] Remove AddrManUncorrupted subclass (John Newbery) dfbd3a6d71f17bf3fbcf88e46e3fedd18a7068f1 [addrman] [tests] Remove AddrManCorrupted subclass (John Newbery) d02098d1f042ff91c2206c27c48b385418ece0cc [addrman] [tests] Tidy up unused arguments in addrman test functions (John Newbery) 7784a9a374ac34acb4656f740fecf4ae1743f73f [addrman] [tests] Remove deterministic argument and member from AddrManTest (John Newbery) a749fa539ae4330dd5d610286f418156e080e9dd [addrman] Remove AddrMan friends (John Newbery) Pull request description: Various tidy-ups to the addrman tests. ACKs for top commit: shaavan: crACK 36d3510303875c9f98eb00b28763c7c043d4dcee promag: Code review ACK 36d3510303875c9f98eb00b28763c7c043d4dcee. theStack: Code-review ACK 36d3510303875c9f98eb00b28763c7c043d4dcee Tree-SHA512: bbdb9d70863c15b023714ba3c73e816c635204f949c39678dd932a6e9a2e57b51b5d50332ec6843cf1b98a2fcbbdd5e6779f2e9c7e9cf90f4a6b3b4a7a1abe2f
2021-11-12Merge bitcoin/bitcoin#23114: Add minisketch subtree and integrate into ↵fanquake
build/test 29173d6c6ca0cc3be9fa6bf2409a509ffea1a02a ubsan: add minisketch exceptions (Cory Fields) 54b5e1aeab73953c1f12ec2c041572038f6f59da Add thin Minisketch wrapper to pick best implementation (Pieter Wuille) ee9dc71c1bc16205494f2a0aebe575a3c062ff52 Add basic minisketch tests (Pieter Wuille) 0659f12b131fc5915fe7a493306af197f4fb838b Add minisketch dependency (Gleb Naumenko) 0eb7928ab8d9dcb840e4965bfa81deb752b00dfa Add MSVC build configuration for libminisketch (Pieter Wuille) 8bc166d5b179205fc56855e2b462aa273a6f8661 build: add minisketch build file and include it (Cory Fields) b2904ceb85b4d440b1f4bbd716fcb601411cc2c9 build: add configure checks for minisketch (Cory Fields) b6487dc4ef47ec9ea894eceac25f37d0b806f8aa Squashed 'src/minisketch/' content from commit 89629eb2c7 (fanquake) Pull request description: This takes over #21859, which has [recently switched](https://github.com/bitcoin/bitcoin/pull/21859#issuecomment-921899200) to my integration branch. A few more build issues came up (and have been fixed) since, and after discussing with sipa it was decided I would open a PR to shepherd any final changes through. > This adds a `src/minisketch` subtree, taken from the master branch of https://github.com/sipa/minisketch, to prepare for Erlay implementation (see #21515). It gets configured for just supporting 32-bit fields (the only ones we're interested in in the context of Erlay), and some code on top is added: > * A very basic unit test (just to make sure compilation & running works; actual correctness checking is done through minisketch's own tests). > * A wrapper in `minisketchwrapper.{cpp,h}` that runs a benchmark to determine which field implementation to use. Only changes since my last update to the branch in the previous PR have been rebasing on master and fixing an issue with a header in an introduced file. ACKs for top commit: naumenkogs: ACK 29173d6c6ca0cc3be9fa6bf2409a509ffea1a02a Tree-SHA512: 1217d3228db1dd0de12c2919314e1c3626c18a416cf6291fec99d37e34fb6eec8e28d9e9fb935f8590273b8836cbadac313a15f05b4fd9f9d3024c8ce2c80d02
2021-11-10Merge bitcoin/bitcoin#23173: Add `ChainstateManager::ProcessTransaction`MarcoFalke
0fdb619aaf1d62598263361a6082d182be1af792 [validation] Always call mempool.check() after processing a new transaction (John Newbery) 2c64270bbe523ef87e7225c351464e7c716f0b3e [refactor] Don't call AcceptToMemoryPool() from outside validation.cpp (John Newbery) 92a3aeecf6a82e9cbc9fda11022b0548efd24d05 [validation] Add CChainState::ProcessTransaction() (John Newbery) 36167faea92c97ddea7403280a5074073c8e5f90 [logging/documentation] Remove reference to AcceptToMemoryPool from error string (John Newbery) 4c24142b1ec121623f81ba644d77341bc1bd88dd [validation] Remove comment about AcceptToMemoryPool() (John Newbery) 5759fd12b8d5937e9187fa33489a95b1d8e6d1e5 [test] Don't set bypass_limits to true in txvalidation_tests.cpp (John Newbery) 497c9e29640858bb3beb20089c2d4f9e133c7e42 [test] Don't set bypass_limits to true in txvalidationcache_tests.cpp (John Newbery) Pull request description: Similarly to how #18698 added `ProcessNewBlock()` and `ProcessNewBlockHeaders()` methods to the `ChainstateManager` class, this PR adds a new `ProcessTransaction()` method. Code outside validation no longer calls `AcceptToMemoryPool()` directly, but calls through the higher-level `ProcessTransaction()` method. Advantages: - The interface is simplified. Calling code no longer needs to know about the active chainstate or mempool object, since `AcceptToMemoryPool()` can only ever be called for the active chainstate, and that chainstate knows which mempool it's using. We can also remove the `bypass_limits` argument, since that can only be used internally in validation. - responsibility for calling `CTxMemPool::check()` is removed from the callers, and run automatically by `ChainstateManager` every time `ProcessTransaction()` is called. ACKs for top commit: lsilva01: tACK 0fdb619 on Ubuntu 20.04 theStack: Code-review ACK 0fdb619aaf1d62598263361a6082d182be1af792 ryanofsky: Code review ACK 0fdb619aaf1d62598263361a6082d182be1af792. Only changes since last review: splitting & joining commits, adding more explanations to commit messages, tweaking MEMPOOL_ERROR string, fixing up argument name comments. Tree-SHA512: 0b395c2e3ef242f0d41d47174b1646b0a73aeece38f1fe29349837e6fb832f4bf8d57e1a1eaed82a97c635cfd59015a7e07f824e0d7c00b2bee4144e80608172
2021-11-09[addrman] [tests] Remove AddrManUncorrupted subclassJohn Newbery
It doesn't do anything different from the base AddrMan class.
2021-11-09[addrman] [tests] Remove AddrManCorrupted subclassJohn Newbery
It's only used to create a corrupted peers.dat file. We can do that directly in a pure function.
2021-11-09[addrman] [tests] Tidy up unused arguments in addrman test functionsJohn Newbery
2021-11-09[addrman] [tests] Remove deterministic argument and member from AddrManTestJohn Newbery
It's always set to true.
2021-11-09span: Add std::byte helpersMarcoFalke
Also, add Span<std::byte> interface to strencondings.
2021-11-09Use value_type in CDataStream where possibleMarcoFalke
Also, simplify unit tests with the CDataStream::str method.
2021-11-09Merge bitcoin/bitcoin#23381: validation/refactor: refactoring for package ↵W. J. van der Laan
submission 14cd7bf793547fa5143acece564482271f5c30bc [test] call CheckPackage for package sanitization checks (glozow) 68763783658f004efd9117fa7a69b0e271c4eaaa MOVEONLY: move package unit tests to their own file (glozow) c9b1439ca9ab691f4672d2cbf33d9381f2985466 MOVEONLY: mempool checks to their own functions (glozow) 9e910d8152e08d26ecce6592870adbe5dabd159e scripted-diff: clean up MemPoolAccept aliases (glozow) fd92b0c3986b9eb41ce28eb602f56d405bdd3cd7 document workspace members (glozow) 3d3e4598b6e570b1f8248b1ee43ec59165a3ff5c [validation] cache iterators to mempool conflicts (glozow) 36a8441912bf84b4da9c74826dcd42533d8abaaa [validation/rpc] cache + use vsize calculated in PreChecks (glozow) 8fa2936b34fda9c0bea963311fa80a04b4bf5867 [validation] re-introduce bool for whether a transaction is RBF (glozow) cbb3598b5ce2bea58a8cb1ad2167d7d1d079acf7 [validation/refactor] store precomputed txdata in workspace (glozow) 0a79eaba729e60a83b0e604e6a18e9ba1ca1bc88 [validation] case-based constructors for ATMPArgs (glozow) Pull request description: This contains the refactors and moves within #22674. There are no behavior changes, so it should be simpler to review. ACKs for top commit: ariard: Code Review ACK 14cd7bf jnewbery: Code review ACK 14cd7bf793547fa5143acece564482271f5c30bc laanwj: Code review ACK 14cd7bf793547fa5143acece564482271f5c30bc, thanks for adding documentation and clarifying the code t-bast: Code Review ACK https://github.com/bitcoin/bitcoin/pull/23381/commits/14cd7bf793547fa5143acece564482271f5c30bc Tree-SHA512: 580ed48b43713a3f9d81cd9b573ef6ac44efe5df2fc7b7b7036c232b52952b04bf5ea92940cf73739f4fbd54ecf980cef58032e8a2efe05229ad0b3c639de8a0
2021-11-08Merge bitcoin/bitcoin#23077: Full CJDNS supportW. J. van der Laan
420695c1933e2b9c6e594fcd8885f1c261e435cf contrib: recognize CJDNS seeds as such (Vasil Dimov) f9c28330a0e77ed077f342e4669e855b3e6b20a1 net: take the first 4 random bits from CJDNS addresses in GetGroup() (Vasil Dimov) 29ff79c0a2a95abf50b78dd2be6ead2abeeaec9f net: relay CJDNS addresses even if we are not connected to CJDNS (Vasil Dimov) d96f8d304c872b21070245c1b6aacc8b1f5da697 net: don't skip CJDNS from GetNetworkNames() (Vasil Dimov) c2d751abbae3811adaf856b1dd1b71b33e54d315 net: take CJDNS into account in CNetAddr::GetReachabilityFrom() (Vasil Dimov) 9b43b3b257a00f777538fcc6e2550702055a1488 test: extend feature_proxy.py to test CJDNS (Vasil Dimov) 508eb258fd569cabda6fe15699f911fd627e0c56 test: remove default argument of feature_proxy.py:node_test() (Vasil Dimov) 6387f397b323b0fb4ca303fe418550f5465147c6 net: recognize CJDNS addresses as such (Vasil Dimov) e6890fcb440245c9a24ded0b7af46267453433f1 net: don't skip CJDNS from GetNetworksInfo() (Vasil Dimov) e9d90d3c11cee8ea70056f69afaa548cee898f40 net: introduce a new config option to enable CJDNS (Vasil Dimov) 78f456c57677e6a3a839426e211078ddf0b3e194 net: recognize CJDNS from ParseNetwork() (Vasil Dimov) de01e312b333b65b09c8dc72f0cea6295ab8e43f net: use -proxy for connecting to the CJDNS network (Vasil Dimov) aedd02ef2750329019d5698b14b17d67c5a563ad net: make it possible to connect to CJDNS addresses (Vasil Dimov) Pull request description: CJDNS overview ===== CJDNS is like a distributed, shared VPN with multiple entry points where every participant can reach any other participant. All participants use addresses from the `fc00::/8` network (reserved IPv6 range). Installation and configuration is done outside of applications, similarly to VPN (either in the host/OS or on the network router). Motivation ===== Even without this PR it is possible to connect two Bitcoin Core nodes through CJDNS manually by using e.g. `-addnode` in environments where CJDNS is set up. However, this PR is necessary for address relay to work properly and automatic connections to be made to CJDNS peers. I.e. to make CJDNS a first class citizen network like IPv4, IPv6, Tor and I2P. Considerations ===== An address from the `fc00::/8` network, could mean two things: 1. Part of a local network, as defined in RFC 4193. Like `10.0.0.0/8`. Bitcoin Core could be running on a machine with such address and have peers with those (e.g. in a local network), but those addresses are not relayed to other peers because they are not globally routable on the internet. 2. Part of the CJDNS network. This is like Tor or I2P - if we have connectivity to that network then we could reach such peers and we do relay them to other peers. So, Bitcoin Core needs to be able to tell which one is it when it encounters a bare `fc00::/8` address, e.g. from `-externalip=` or by looking up the machine's own addresses. Thus a new config option is introduced `-cjdnsreacable`: * `-cjdnsreacable=0`: it is assumed a `fc00::/8` address is a private IPv6 (1.) * `-cjdnsreacable=1`: it is assumed a `fc00::/8` address is a CJDNS one (2.) After setting up CJDNS outside of Bitcoin Core, a node operator only needs to enable this option. Addresses from P2P relay/gossip don't need that because they are properly tagged as IPv6 or as CJDNS. For testing ===== ``` [fc32:17ea:e415:c3bf:9808:149d:b5a2:c9aa]:8333 [fc68:7026:cb27:b014:5910:e609:dcdb:22a2]:8333 [fcb3:dc50:e1ae:7998:7dc0:7fa6:4582:8e46]:8333 [fcc7:be49:ccd1:dc91:3125:f0da:457d:8ce]:8333 [fcf2:d9e:3a25:4eef:8f84:251b:1b4d:c596]:8333 ``` ACKs for top commit: dunxen: ACK 420695c jonatack: re-ACK 420695c1933e2b9c6e594fcd8885f1c261e435cf per `git range-diff 23ae793 4fbff39 420695c` laanwj: Code review ACK 420695c1933e2b9c6e594fcd8885f1c261e435cf Tree-SHA512: 21559886271aa84671d52b120fa3fa5a50fdcf0fcb26e5b32049c56fab0d606438d19dd366a9c8ce612d3894237ae6d552ead3338b326487e3534399b88a317a
2021-11-08Merge bitcoin/bitcoin#23409: refactor: Take Span in SetSeedW. J. van der Laan
fa93ef5a8aeae36304c792697a78af2d07fd9f41 refactor: Take Span in SetSeed (MarcoFalke) Pull request description: This makes calling code less verbose and less fragile. Also, by adding the CKey::data() member function, it is now possible to call HexStr() with a CKey object. ACKs for top commit: sipa: utACK fa93ef5a8aeae36304c792697a78af2d07fd9f41 laanwj: Code review ACK fa93ef5a8aeae36304c792697a78af2d07fd9f41 theStack: Code-review ACK fa93ef5a8aeae36304c792697a78af2d07fd9f41 Tree-SHA512: 73fb999320719ad4b9ab5544018a7a083d140545c2807ee3582ecf7f441040a30b5157e85790b6b840af82f002a7faf30bd8162ebba5caaf2067391c43dc7e25
2021-11-04[test] call CheckPackage for package sanitization checksglozow
Makes the test more minimal. We're just trying to test that our package sanitization logic is correct. Now that this code lives in its own function (rather than inside of AcceptMultipleTransactions), there's no need to call ProcessNewPackage to test this.
2021-11-04MOVEONLY: move package unit tests to their own fileglozow
2021-11-04Open streams_test_tmp file in temporary folderMartin Leitner-Ankerl
The tests `streams_tests/streams_buffered_file` and `streams_tests/streams_buffered_file_rand` did not use a the temporary directory provided by `BasicTestingSetup`, so it was not possible to execute multiple of them in parallel. This fixes that. To reproduce, run ```sh parallel --halt now,fail=1 './src/test/test_bitcoin --run_test=streams_tests/streams_buffered_file_rand' -- ::: {1..1000} ``` This executes the test 1000 times, one job per CPU. It works on that commit but mergebase fails quickly.
2021-11-05Merge bitcoin/bitcoin#22949: fee: Round up fee calculation to avoid a lower ↵Samuel Dobson
than expected feerate 80dc829be7f8c3914074b85bb4c125baba18cb2c tests: Calculate fees more similarly to CFeeRate::GetFee (Andrew Chow) ce2cc44afd51f3df4ee7f14ea05b8da229183923 tests: Test for assertion when feerate is rounded down (Andrew Chow) 0fbaef9676a1dcb84bcf95afd8d994831ab327b6 fees: Always round up fee calculated from a feerate (Andrew Chow) Pull request description: When calculating the fee for a feerate, it is possible that the final calculation will have fractional satoshis. Currently those are ignored via truncation which results in the absolute fee being rounded down. Rounding down is problematic because it results in a feerate that is slightly lower than the feerate represented by the `CFeeRate` object. A slightly lower feerate particularly causes issues for coin selection as it can trigger an assertion error. To avoid potentially underpaying the feerate (and the assertion), always round up the calculated fee. A test is added for the assertion, along with a comment explaining what happens. It is unlikely that a user can trigger this as it requires a very specific set of rounding errors to occur as well as the transaction not needing any change and being right on the lower bound of the exact match window. However I was able to trigger the assertion while running coin selection simulations, albeit after thousands of transactions and with some weird feerates. ACKs for top commit: ryanofsky: Code review ACK 80dc829be7f8c3914074b85bb4c125baba18cb2c promag: Tested ACK 80dc829be7f8c3914074b85bb4c125baba18cb2c. lsilva01: tACK 80dc829 meshcollider: utACK 80dc829be7f8c3914074b85bb4c125baba18cb2c Tree-SHA512: fe26684c60f236cab48ea6a4600c141ce766dbe59504ec77595dcbd7fd0b34559acc617007f4f499c9155d8fda0a336954413410ba862b19c765c0cfac79d642
2021-11-03[refactor] Don't call AcceptToMemoryPool() from outside validation.cppJohn Newbery
2021-11-03net: recognize CJDNS from ParseNetwork()Vasil Dimov
This allows to use "cjdns" as an argument to the `getnodeaddresses` RPC and to the `-onlynet=` parameter.
2021-11-03[test] Don't set bypass_limits to true in txvalidation_tests.cppJohn Newbery
AcceptToMemoryPool() is called for an invalid coinbase transaction, so setting bypass_limits to true or false has no impact on the test. The only way that changing bypass_limits from true to false could change the result would be to change the outcome to INVALID(TX_MEMPOOL_POLICY). Since the ATMP call in this test results in INVALID(TX_CONSENSUS) both before and after this change, there is no change in behavior.
2021-11-03[test] Don't set bypass_limits to true in txvalidationcache_tests.cppJohn Newbery
AcceptToMemoryPool() is called for transactions with fees above minRelayTxFee and with the mempool not full, so setting bypass_limits to true or false has no impact on the test. The only way that changing bypass_limits from true to false could change the result would be to change the outcome to INVALID(TX_MEMPOOL_POLICY). Since all the ATMP calls in this test result in VALID both before and after this change, there is no change in behavior.
2021-11-02Merge bitcoin/bitcoin#23223: Disable lock contention logging in checkqueue_testsMarcoFalke
6ae9f1cf9604227e9dfda1f6c91fc711d154362e Disable lock contention logging in checkqueue_tests (Jon Atack) Pull request description: This patch disables lock contention logging in the checkqueue_tests as some of these tests are designed to be heavily contested to trigger race conditions or other issues. This created very large log files when run with DEBUG_LOCKCONTENTION defined (up to v22) or with lock logging enabled by default in current master. Examples running the following command: ``` $ ./src/test/test_bitcoin -t checkqueue_tests/test_CheckQueue_Correct_Random -- DEBUG_LOG_OUT > testlog.txt -rw-r--r-- 87042178 Oct 8 12:41 testlog-with-DEBUG_LOCKCONTENTION-at-v22-run1.txt -rw-r--r-- 73879896 Oct 8 12:42 testlog-with-DEBUG_LOCKCONTENTION-at-v22-run2.txt -rw-r--r-- 65150518 Oct 8 12:51 testlog-with-DEBUG_LOCKCONTENTION-at-bb9f76a-run1.txt -rw-r--r-- 65774554 Oct 8 12:52 testlog-with-DEBUG_LOCKCONTENTION-at-bb9f76a-run2.txt -rw-r--r-- 73493309 Oct 8 13:00 testlog-current-master-at-991753e-run1.txt -rw-r--r-- 65616977 Oct 8 13:01 testlog-current-master-at-991753e-run2.txt -rw-r--r-- 5093 Oct 8 13:04 testlog-with-this-commit-run1.txt -rw-r--r-- 5093 Oct 8 13:05 testlog-with-this-commit-run2.txt ``` Resolves #23167. ACKs for top commit: vasild: ACK 6ae9f1cf9604227e9dfda1f6c91fc711d154362e Tree-SHA512: b16812ed60c58a1cf40c04ebeca9197ac076b2415f71673ac7bb5b7960a1ff80ba2c909345ad221c7689b0562d17f63a32a629f5d6dbcf0e57130bf5760388c1
2021-11-02Merge bitcoin/bitcoin#22735: [net] Don't return an optional from ↵MarcoFalke
TransportDeserializer::GetMessage() f3e451bebfe2e2d8de901d8ac29c064a51d3b746 [net] Replace GetID() with id in TransportDeserializer constructor (Troy Giorshev) 8c96008ab18075abca03bff6b3675643825a21ca [net] Don't return an optional from TransportDeserializer::GetMessage() (Troy Giorshev) Pull request description: Also, access mapRecvBytesPerMsgCmd with `at()` not `find()`. This throws an error if COMMAND_OTHER doesn't exist, which should never happen. `find()` instead just accessed the last element, which could make debugging more difficult. Resolves review comments from PR19107: - https://github.com/bitcoin/bitcoin/pull/19107#discussion_r478718436 - https://github.com/bitcoin/bitcoin/pull/19107#discussion_r478714497 ACKs for top commit: theStack: Code-review ACK f3e451bebfe2e2d8de901d8ac29c064a51d3b746 ryanofsky: Code review ACK f3e451bebfe2e2d8de901d8ac29c064a51d3b746. Changes since last review in https://github.com/bitcoin/bitcoin/pull/20364#pullrequestreview-534369904 were simplifying by dropping the third commit, rebasing, and cleaning up some style & comments in the first commit. Tree-SHA512: 37de4b25646116e45eba50206e82ed215b0d9942d4847a172c104da4ed76ea4cee29a6fb119f3c34106a9b384263c576cb8671d452965a468f358d4a3fa3c003