aboutsummaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2021-09-07Make unexpected time type in BCLog::LogMsg() a compile-time errorMartin Ankerl
2021-09-07log, timer: improve BCLog::LogMsg()Jon Atack
- make timer code more homogeneous - replace division with multiplication - log if the time type is unexpected
2021-09-06Merge bitcoin/bitcoin#22791: init: Fix asmap/addrman initialization order bugMarcoFalke
724c4975622bc22cedc3f3814dfc8e66cf8371f7 [fuzz] Add ConsumeAsmap() function (John Newbery) 5840476714ffebb2599999c85a23b52ebcff6090 [addrman] Make m_asmap private (John Newbery) f9002cb5dbd573cd9ca200de21319fa296e26055 [net] Rename the copyStats arg from m_asmap to asmap (John Newbery) f572f2b2048994b3b50f4cfd5de19e40b1acfb22 [addrman] Set m_asmap in CAddrMan initializer list (John Newbery) 593247872decd6d483a76e96d79433247226ad14 [net] Remove CConnMan::SetAsmap() (John Newbery) 50fd77045e2f858a53486b5e02e1798c92ab946c [init] Read/decode asmap before constructing addrman (John Newbery) Pull request description: Commit 181a1207 introduced an initialization order bug: CAddrMan's m_asmap must be set before deserializing peers.dat. The first commit restores the correct initialization order. The remaining commits make `CAddrMan::m_asmap` usage safer: - don't reach into `CAddrMan`'s internal data from `CConnMan` - set `m_asmap` in the initializer list and make it const - make `m_asmap` private, and access it (as a reference to const) from a getter. This ensures that peers.dat deserialization must happen after setting m_asmap, since m_asmap is set during CAddrMan construction. ACKs for top commit: mzumsande: Tested ACK 724c4975622bc22cedc3f3814dfc8e66cf8371f7 amitiuttarwar: code review but utACK 724c497562 naumenkogs: utACK 724c4975622bc22cedc3f3814dfc8e66cf8371f7 vasild: ACK 724c4975622bc22cedc3f3814dfc8e66cf8371f7 MarcoFalke: review ACK 724c4975622bc22cedc3f3814dfc8e66cf8371f7 👫 Tree-SHA512: 684a4cf9e3d4496c9997fb2bc4ec874809987055c157ec3fad1d2143b8223df52b5a0af787d028930b27388c8efeba0aeb2446cb35c337a5552ae76112ade726
2021-09-06Merge bitcoin/bitcoin#22736: log, sync: change lock contention from ↵MarcoFalke
preprocessor directive to log category 7e698732836121912f179b7c743a72dd6fdffa72 sync: remove DEBUG_LOCKCONTENTION preprocessor directives (Jon Atack) 9b08006bc502e67956d6ab518388fad6397cac8d log, sync: improve lock contention logging and add time duration (Jon Atack) 3f4c6b87f1098436693c4990f2082515ec0ece26 log, timer: add timing macro in usec LOG_TIME_MICROS_WITH_CATEGORY (Jon Atack) b7a17444e0746c562ae97b26eba431577947b06a log, sync: add LOCK logging category, apply it to lock contention (Jon Atack) Pull request description: To enable lock contention logging, `DEBUG_LOCKCONTENTION` has to be defined at compilation. Once built, the logging is not limited to a category and is high frequency, verbose and in all-caps. With these factors combined, it seems likely to be rarely used. This patch: - adds a `lock` logging category - adds a timing macro in microseconds, `LOG_TIME_MICROS_WITH_CATEGORY` - updates `BCLog::LogMsg()` to omit irrelevant decimals for microseconds and skip unneeded code and math - improves the lock contention logging, drops the all-caps, and displays the duration in microseconds - removes the conditional compilation directives - allows lock contentions to be logged on startup with `-debug=lock` or at run time with `bitcoin-cli logging '["lock"]'` ``` $ bitcoind -signet -debug=lock 2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1920 started 2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1920 completed (4μs) 2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1302 started 2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1302 completed (4μs) 2021-09-01T12:40:02Z LockContention: cs_vNodes, net.cpp:2242 started 2021-09-01T12:40:02Z LockContention: cs_vNodes, net.cpp:2242 completed (20μs) 2021-09-01T12:43:04Z LockContention: ::cs_main, validation.cpp:4980 started 2021-09-01T12:43:04Z LockContention: ::cs_main, validation.cpp:4980 completed (3μs) $ bitcoin-cli -signet logging "lock": true, $ bitcoin-cli -signet logging [] '["lock"]' "lock": false, $ bitcoin-cli -signet logging '["lock"]' "lock": true, ``` I've tested this with Clang 13 and GCC 10.2.1, on Debian, with and without `--enable-debug`. ACKs for top commit: hebasto: re-ACK 7e698732836121912f179b7c743a72dd6fdffa72, added a contention duration to the log message since my [previous](https://github.com/bitcoin/bitcoin/pull/22736#pullrequestreview-743764606) review. theStack: re-ACK 7e698732836121912f179b7c743a72dd6fdffa72 🔏 ⏲️ Tree-SHA512: c4b5eb88d3a2c051acaa842b3055ce30efde1f114f61da6e55fcaa27476c1c33a60bc419f7f5ccda532e1bdbe70815222ec2b2b6d9226f29c8e94e598aacfee7
2021-09-05Merge bitcoin/bitcoin#22859: Replace uses of boost::trim* with ↵fanquake
locale-independent alternatives (#18130 rebased) 696c76d6604c9c4faddfc4b6684e2788bb577ba6 tests: Add TrimString(...) tests (practicalswift) 4bf18b089e1bb1f3ab513cbdf6674bd1074f4621 Replace use of boost::trim_right with locale-independent TrimString (Ben Woosley) 93551862a18965bcee0c883c54807e8726e2f50f Replace use of boost::trim use with locale-independent TrimString (Ben Woosley) Pull request description: This is [#18130 rebased](https://github.com/bitcoin/bitcoin/pull/18130#issuecomment-900158759). > `TrimString` is an existing alternative. > Note `TrimString` uses `" \f\n\r\t\v"` as the pattern, which is consistent with the default behavior of `std::isspace`. See: https://en.cppreference.com/w/cpp/string/byte/isspace ACKs for top commit: jb55: utACK 696c76d6604c9c4faddfc4b6684e2788bb577ba6 practicalswift: ACK 696c76d6604c9c4faddfc4b6684e2788bb577ba6 jonatack: ACK 696c76d6604c9c4faddfc4b6684e2788bb577ba6 theStack: Code-review ACK 696c76d6604c9c4faddfc4b6684e2788bb577ba6 Tree-SHA512: 6a70e3777602dfa65a60353e5c6874eb951e4a806844cd4bdaa4237cad980a4f61ec205defc05a29f9707776835975838f6cc635259c42adfe37ceb02ba9358d
2021-09-02test: Always clear reject reason in IsStandard tx testMarcoFalke
2021-09-02Merge bitcoin/bitcoin#22846: policy: unit test Segwit dust thresholdsMarcoFalke
97cea1a93a26d535f9bad038b559e50437ea54f7 policy: unit test Segwit dust thresholds (Antoine Poinsot) Pull request description: This is the unit testing part of #22779, hence without the threshold modification. ACKs for top commit: MarcoFalke: cr ACK 97cea1a93a26d535f9bad038b559e50437ea54f7 benthecarman: crACK 97cea1a93a26d535f9bad038b559e50437ea54f7 Tree-SHA512: 96fb194709ae44364455eb920ed3ecff2e11e5327e0a72b9eeec9f9445894302099a0c4ffb1e0c8d4d523c0bfe06c57f1ebb0c03cf3389a73f518e3b174c45aa
2021-09-02tests: Add TrimString(...) testspracticalswift
2021-09-02Merge bitcoin/bitcoin#22853: fuzz: Remove addrdb fuzz targetfanquake
fa18553d382a7d8c447cd6698b36e293fb7ecf1f fuzz: Remove addrdb fuzz target (MarcoFalke) Pull request description: The target has several issues: * It is named incorrectly (`addrdb`, but it constructs a `CBanEntry`) * It doesn't do anything meaningful, other than consuming one integer and passing it to a constructor * It consumes CPU time that can be used for the other targets * It is redundant with the banman fuzz target Fix all by removing it. ACKs for top commit: amitiuttarwar: ACK fa18553d382a7d8c447cd6698b36e293fb7ecf1f, thanks for the cleanup Tree-SHA512: 3f8944d3f80913bf466c03062fed070e96073fb72d0938b2bc9a2586960c86879d6f251e16fd81cfeb4e6685ff9eef6bccb25cd3901b218a100c90f25a3c9240
2021-09-02Merge bitcoin/bitcoin#22836: Stricter BIP32 decoding and test vector 5fanquake
56a42f10f452f0ac0e3e333646a8effcbebf6b30 Stricter BIP32 decoding and test vector 5 (Pieter Wuille) Pull request description: This adds detection for various edge cases when decoding BIP32 extended pubkeys/privkeys, and tests them using the proposed https://github.com/bitcoin/bips/pull/921 BIP32 test vector 5. ACKs for top commit: darosior: utACK 56a42f10f452f0ac0e3e333646a8effcbebf6b30 -- Had to implement essentially the same fix in python-bip32. kristapsk: ACK 56a42f10f452f0ac0e3e333646a8effcbebf6b30. Checked that test vectors are the same as in BIP32 and that tests pass. Tree-SHA512: 5cc800cc9dc10e43ae89b659ce4f44026d04ec3cabac4eb5122d2e72ec2ed66cd5ace8c7502259e469a9ecaa5ecca2457e55dfe5fedba59948ecbf6673af67a7
2021-09-01log, timer: add timing macro in usec LOG_TIME_MICROS_WITH_CATEGORYJon Atack
and update BCLog::LogMsg() to omit irrelevant decimals for microseconds and skip unneeded code and math.
2021-09-01fuzz: Remove addrdb fuzz targetMarcoFalke
2021-08-31Remove unused SERIALIZE_METHODS for CBanEntryMarcoFalke
2021-08-31policy: unit test Segwit dust thresholdsAntoine Poinsot
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2021-08-30Stricter BIP32 decoding and test vector 5Pieter Wuille
2021-08-27[fuzz] Add ConsumeAsmap() functionJohn Newbery
2021-08-27[net] Rename the copyStats arg from m_asmap to asmapJohn Newbery
The m_ prefix indicates that a variable is a data member. Using it as a parameter name is misleading. Also update the name of the function from copyStats to CopyStats to comply with our style guide.
2021-08-27[addrman] Set m_asmap in CAddrMan initializer listJohn Newbery
This allows us to make it const.
2021-08-27Merge bitcoin/bitcoin#22782: Remove unused MaybeSetAddrNameMarcoFalke
fa9eade142964d5482fe8d2109fb67a9556ae93d Remove GetAddrName (MarcoFalke) fa786570a5fdf6723b35883054f9f840a3440f92 Remove unused RecursiveMutex cs_addrName (MarcoFalke) fa82f4ea96749115311cffa0919d49d383c4d28b Remove unused MaybeSetAddrName (MarcoFalke) Pull request description: . ACKs for top commit: jnewbery: Code review ACK fa9eade142964d5482fe8d2109fb67a9556ae93d naumenkogs: utACK fa9eade142964d5482fe8d2109fb67a9556ae93d Tree-SHA512: 61501a699add59225dc8127b6dfdda450d768c86f958fdf94e9c28309c3705ecfbee4b064d44228b8c1190c19c39272becc7ede8386ac1406699ea2285881c72
2021-08-26Merge bitcoin/bitcoin#22648: doc, test: improve i2p/tor docs and i2p ↵W. J. van der Laan
reachable unit tests 017597767b977bb8fe11be8e2012130df1dffd30 Add I2P network SetReachable/IsReachable unit test assertions (Jon Atack) b87a9c4d13329a6236124d4b93580c4df8107b32 Improve doc/i2p.md regarding I2P router options/versions (Jon Atack) bebcf785c080df9273e03b854832ba3dbd4320ec Update i2p.md and tor.md regarding -onlynet config option (Jon Atack) Pull request description: This pull addresses https://github.com/bitcoin/bitcoin/issues/22634#issuecomment-894104681 and various user feedback/questions, updates the -onlynet documentation in doc/i2p.md and doc/tor.md per #22651 (src/init.cpp is already fine) and fills in some missing I2P unit test coverage. Note: this PR depends in part on whether #22651 is merged in order to propose the correct -onlynet documentation (it is currently aligned with the change in #22651), so that PR should be decided or merged first. ACKs for top commit: Rspigler: Re-ACK 017597767b977bb8fe11be8e2012130df1dffd30 prayank23: reACK https://github.com/bitcoin/bitcoin/commit/017597767b977bb8fe11be8e2012130df1dffd30 vasild: ACK 017597767b977bb8fe11be8e2012130df1dffd30 Tree-SHA512: ae606437522bfccdfb7508108cddc7dfede2385e30a0561dbd007b784ed2639962c28552eb0e9336412faa323637fe964c26b8d8fc6dcf9fc63734ac00d05736
2021-08-26Remove GetAddrNameMarcoFalke
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines.html#c131-avoid-trivial-getters-and-setters
2021-08-26Merge bitcoin/bitcoin#22755: fuzz: Avoid timeout in blockfilter fuzz targetMarcoFalke
fa2547fc52b90b4bbde250803df24d7f665383a7 fuzz: Avoid timeout in blockfilter fuzz target (MarcoFalke) Pull request description: Previously it would take 10 seconds to run this input, now it takes 10ms: [clusterfuzz-testcase-blockfilter-5022838196142080.log](https://github.com/bitcoin/bitcoin/files/7021883/clusterfuzz-testcase-blockfilter-5022838196142080.log) The fix is moving the `MatchAny` out of the hot loop. Also, to avoid unlimited runtime, cap the hot loop at 30k iterations. ACKs for top commit: GeneFerneau: Approach ACK [fa2547f](https://github.com/bitcoin/bitcoin/pull/22755/commits/fa2547fc52b90b4bbde250803df24d7f665383a7) Tree-SHA512: a04e7388856930ec81222da8f05b665a923fe9482aeb4c55c9be4561aa7320a0703dbbf8d438ae92854e877a8e3b46777a29c0b652b8f34c29c2142cc5d63ccb
2021-08-25[net] Remove CConnMan::SetAsmap()John Newbery
CAddrMan::m_asmap is now set directly in AppInitMain() so CConnMan::SetAsmap() is no longer required.
2021-08-24Remove unused MaybeSetAddrNameMarcoFalke
This logic is a no-op since it was introduced in commit f9f5cfc50637f2cd1540923caf337e2651ec1625. m_addr_name is never initialized to the empty string, because ToStringIPPort never returns an empty string.
2021-08-24Merge bitcoin/bitcoin#22220: util: make ParseMoney return a ↵fanquake
std::optional<CAmount> f7752adba5dd35fccd3f2144cfcf03538ebf275b util: check MoneyRange() inside ParseMoney() (fanquake) 5ef2738089efd396186775ad23aaec71ea44ebb1 util: make ParseMoney return a std::optional<CAmount> (fanquake) Pull request description: Related discussion in #22193. ACKs for top commit: MarcoFalke: review ACK f7752adba5dd35fccd3f2144cfcf03538ebf275b 📄 Tree-SHA512: 88453f9e28f668deff4290d4bc0b2468cbd54699a3be1bfeac63a512276d309354672e7ea7deefa01466c3d9d826e837cc1ea244d4d74b4fa9c11c56f074e098
2021-08-23Merge bitcoin/bitcoin#22769: fuzz: Use LIMITED_WHILE instead of limit_max_opsMarcoFalke
faa5fa9a78d6d23b4e9adea07fdfb34ead170a2f fuzz: Use LIMITED_WHILE instead of limit_max_ops (MarcoFalke) Pull request description: This avoids the local stack variable `limit_max_ops` and makes it easier to grep for limited loops. Also, it is less code. ACKs for top commit: theStack: Code-review ACK faa5fa9a78d6d23b4e9adea07fdfb34ead170a2f 🍷 Zero-1729: crACK faa5fa9a78d6d23b4e9adea07fdfb34ead170a2f 🥤 Tree-SHA512: b10d89f4ce57bac0d6e9de9db7d4db85bae81bc02536d46a910be8c0e77333f2d9a547c7fe03df57f5ff9fd90b6994b09996d8e148573fb7ecd840d08b5c0c7d
2021-08-23Merge bitcoin/bitcoin#22275: A few follow-ups for taproot signingfanquake
08f57a0057c58f19cd8ae3de89548d014980478a Assert that IsComplete() in GetSpendData() (Pieter Wuille) d8f4b976d5ae9e6eee741dfdda53b8bc8573221b Remove default nHashTypeIn arguments to MutableTransactionSignatureCreator (Pieter Wuille) c7048aae9545afd8d522e200ecadcf69f22399a0 Simplify SignTransaction precomputation loop (Pieter Wuille) addb9b5a71ff96bdb1a4c15bc9345de0d7f2c98c Improve comments in taproot signing logic (Pieter Wuille) Pull request description: This addresses a few review comments from #21365 that were left at the time of merge (as well as some from #22166 applying to the commit it shared with #21365). I do not think any are blockers for a 22.0 release. ACKs for top commit: theStack: re-ACK 08f57a0057c58f19cd8ae3de89548d014980478a 🌴 Zero-1729: crACK 08f57a0 jonatack: Code review ACK 08f57a0057c58f19cd8ae3de89548d014980478a per `git range-diff e9d6eb1 9336670 08f57a0` followed by re-code review per commit to swap context back into memory and debug build/run unit tests + feature_taproot.py as a sanity check Tree-SHA512: 968750109ba8d6faf3016035a38f81c6aefb724c632a3cab0bbf43cf31b9d187b6b0fddd8772768f57338df11eb07ab9c4c6dacdf3cf35b71f29699c67a301ea
2021-08-21fuzz: Use LIMITED_WHILE instead of limit_max_opsMarcoFalke
2021-08-21Merge bitcoin/bitcoin#22633: refactor: Replace remaining binascii method callsMarcoFalke
021daedfa100defad553d69cd3d628aaa5bc7caf refactor: replace remaining binascii method calls (Zero-1729) Pull request description: This PR removes the remaining `binascii` method calls outside `test/functional` and `test_framework`, as pointed out here https://github.com/bitcoin/bitcoin/pull/22619#pullrequestreview-722153458. Follow-up to #22593 and #22619 Closes #22605 ACKs for top commit: josibake: re-ACK https://github.com/bitcoin/bitcoin/pull/22633/commits/021daedfa100defad553d69cd3d628aaa5bc7caf theStack: re-ACK 021daedfa100defad553d69cd3d628aaa5bc7caf Tree-SHA512: 2ae9fee8917112c91a5406f219ca70f24cd8902b903db5a61fc2de85ad640d669a772f5c05970be0fcee6ef1cdd32fae2ca5d1ec6dc9798b43352c8160ddde6f
2021-08-20Remove default nHashTypeIn arguments to MutableTransactionSignatureCreatorPieter Wuille
These were unused except in tests, and were also overlooked when changing SIGHASH_ALL -> SIGHASH_DEFAULT.
2021-08-20fuzz: Avoid timeout in blockfilter fuzz targetMarcoFalke
2021-08-20Merge bitcoin/bitcoin#22697: addrman: Remove CAddrMan::Clear() functionfanquake
4d2fa97031a6f31da984d4c2c105447ed692c6ed [addrman] Clean up ctor (John Newbery) 7e6e65918f75211b517fc887f5d90df8edd52ced [addrman] inline Clear() into CAddrMan ctor (John Newbery) 406be5ff9699874dc1d38d11f036e33cbdb820c9 [addrman] Remove all public uses of CAddrMan.Clear() from the tests (John Newbery) ed9ba8af08f857bda3ce2f77413317374c22d7b4 [tests] Remove CAddrMan.Clear() call from CAddrDB::Read() (John Newbery) e8e7392311edf44278d76743bebe902d4ac94662 [addrman] Don't call Clear() if parsing peers.dat fails (John Newbery) 181a1207ba6bd179d181f3e2534ef8676565ce72 [addrman] Move peers.dat parsing to init.cpp (John Newbery) Pull request description: `CAddrMan::Clear()` exists to reset the internal state of `CAddrMan`. It's currently used in two places: - on startup, if deserializing peers.dat fails, `Clear()` is called to reset to an empty addrman - in tests, `Clear()` is called to reset the addrman for more tests In both cases, we can simply destruct the `CAddrMan` and construct a new, empty addrman. That approach is safer - it's possible that `Clear()` could 'reset' the addrman to a state that's not equivalent to a freshly constructed addrman (one actual example of this is that `Clear()` does not clear the `m_tried_collisions` set). On the other hand, if we destruct and then construct a fresh addrman, we're guaranteed that the new object is empty. This wasn't possible when addrman was initially implemented, since it was a global, and so it would only be destructed on shutdown. However, addrman is now owned by `node.context`, so we have control over its destruction/construction. ACKs for top commit: laanwj: Code review ACK 4d2fa97031a6f31da984d4c2c105447ed692c6ed vasild: ACK 4d2fa97031a6f31da984d4c2c105447ed692c6ed Zero-1729: crACK 4d2fa97031a6f31da984d4c2c105447ed692c6ed Tree-SHA512: f715bf2cbff4f8c3a9dbc613f8c7f11846b065d6807faf3c7d346a0b0b29cbe7ce1dc0509465c2c9b88a8ad55299c9182ea53f5f743e47502a69a0f375e09408
2021-08-19Add I2P network SetReachable/IsReachable unit test assertionsJon Atack
and simplify similar neighboring assertions.
2021-08-19[addrman] inline Clear() into CAddrMan ctorJohn Newbery
Clear() is now only called from the ctor, so just inline the code into that function. The LOCK(cs) can be removed, since there can be no data races in the ctor. Also move the function definition out of the header and into the cpp file.
2021-08-19[addrman] Remove all public uses of CAddrMan.Clear() from the testsJohn Newbery
Just use unique_ptr<CAddrMan>s and reset the pointer if a frest addrman is required. Also make CAddrMan::Clear() private to ensure that no call sites are missed.
2021-08-19Merge bitcoin/bitcoin#22331: crypto: Fix K1/K2 use in ChaCha20-Poly1305 AEADfanquake
cd37356ff9a1a3c2365c4fe3c716d1ca74185d73 [crypto] Fix K1/K2 use in ChaCha20-Poly1305 AEAD (Dhruv Mehta) Pull request description: BIP324 mentions K1 is used for the associated data and K2 is used for the payload. The code does the opposite. This is not a security problem but will be a problem across implementations based on the HKDF key derivations. BIP324 author Jonas Schnelli thinks a [code update will be better](https://github.com/bitcoin/bitcoin/pull/15649#discussion_r440780669) than a BIP update. If this PR is merged: - [ ] We need to update the test vector 3 in BIP324 ACKs for top commit: jonasschnelli: utACK cd37356ff9a1a3c2365c4fe3c716d1ca74185d73 Tree-SHA512: e2165117bfbf7a031060e7376912f9af1c1bfc57916383799a0fa2c040e2caaab0d6aafc3425c083a233b96c84fafec75c938e00ceb6bd7d52607d58607cb145
2021-08-18[tests] Remove CAddrMan.Clear() call from CAddrDB::Read()John Newbery
`bool CAddrDB::Read(CAddrMan& addr, CDataStream& ssPeers)` is _only_ called from the tests, and the call to addr.Clear() only exists so that a test that Clear() is called passes. Remove that test and the call.
2021-08-16refactor: replace remaining binascii method calls Zero-1729
2021-08-17[MOVEONLY] [tests] Move addrman ser/deser tests to addrman_tests.cppJohn Newbery
Addrman serialization/deserialization tests are currently in net_tests.cpp. Move them to addrman_tests.cpp with the rest of the addrman tests. Reviewer hint: review using `git diff --color-moved=dimmed-zebra`
2021-08-17Merge bitcoin/bitcoin#22627: [addrman] De-duplicate Add() functionfanquake
60e0cbdd574bb9109bcad1e0c27c7936a534a0e7 [addrman] Merge the two Add() functions (Amiti Uttarwar) Pull request description: This PR merges the two definitions of this overloaded function to reduce code duplication. When these functions were introduced in https://github.com/bitcoin/bitcoin/commit/5fee401fe14aa6459428a26a82f764db70a6a0b9, there were multiple places that invoked `Add()` with a single addr and a vector of addrs each, so it made sense to overload the function. I could see how the small difference in log statement was more meaningful when a peer was added via IRC :) Now, the definition of `Add()` that takes in a single address is only invoked from the hidden/test-only RPC `addpeeraddress`. These changes should not cause any observable difference, and are covered by the existing tests that use this RPC endpoint. ACKs for top commit: jnewbery: Code review ACK 60e0cbdd574bb9109bcad1e0c27c7936a534a0e7 Zero-1729: crACK 60e0cbd fanquake: ACK 60e0cbdd574bb9109bcad1e0c27c7936a534a0e7 Tree-SHA512: 782fb2ac6d2d403ba7d7ff543197ca42b610b9a8806952d271e57e2ee3527ad1a94af4ebbad5371b5e95d77df07c56ccc8c1d5a2c82cdecb0d2b5085b3bdd5ee
2021-08-16Merge bitcoin/bitcoin#22649: fuzz: Avoid OOM in system fuzz targetMarcoFalke
fa7718344d2879bb3f3c00a4185c5445390c017d fuzz: Avoid OOM in system fuzz target (MarcoFalke) Pull request description: If the inputs size is unlimited, the target may consume unlimited memory, because the argsmanager stores the argument names. Limiting the size should fix this issue. Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36906 ACKs for top commit: practicalswift: cr ACK fa7718344d2879bb3f3c00a4185c5445390c017d Tree-SHA512: 6edfcf324ee9d94e511038ee01340f02db50bcb233af3f1a1717c3602164c88528d9d987e971ec32f1a4593b868019bea0102c53c9b02bfefec3dfde959483cf
2021-08-15[addrman] Merge the two Add() functionsAmiti Uttarwar
Merge the two definitions of this overloaded function to reduce code duplication.
2021-08-13Merge bitcoin/bitcoin#20233: addrman: Make consistency checks a runtime optionfanquake
a4d78546b0858602c60c03fdf8b35ca666ab2e56 [addrman] Make addrman consistency checks a runtime option (John Newbery) 10aac241455a3270462d49b53732477ed97623e7 [tests] Make deterministic addrman use nKey = 1 (John Newbery) fa9710f62c29c7f8d71c9f281001c9b5e70946bf [addrman] Add deterministic argument to CAddrMan ctor (John Newbery) ee458d84fc187d69f002ebead6fccc4f4f9c0744 Add missing const to CAddrMan::Check_() (MarcoFalke) Pull request description: CAddrMan has internal consistency checks. Currently, these are only run when the program is compiled with the `DEBUG_ADDRMAN` option. This option is not enabled on any of our CI builds, and it's likely that no-one is running them at all. This PR makes consistency checks a (hidden) runtime option that can be enabled with `-checkaddrman`, where `-checkaddrman=n` will result in the consistency checks running every n operations (similar to `-checkmempool=n`). We set the ratio to 1/100 for our unit tests, and leave it disabled by default for all networks. Additionally, a consistency check failure now asserts, rather than logging and continuing. This matches the behavior of CTxMemPool and TxRequestTracker, where a failed consistency check asserts. ACKs for top commit: jonatack: ACK a4d78546b0858602c60c03fdf8b35ca666ab2e56 per `git diff 00fd089 a4d7854`, tested by adding logging similar to #22479 and running with `-checkaddrman=<n>` for various values 0/1/10/100 etc, tested the updated docs with `bitcoind -help-debug | grep -A2 "checkaddrman\|checkmempool"` and verified rebased on master that compiling with `CPPFLAGS="-DDEBUG_ADDRMAN"` no longer causes the build to error. mzumsande: Code-review ACK a4d78546b0858602c60c03fdf8b35ca666ab2e56 theStack: Code-review ACK a4d78546b0858602c60c03fdf8b35ca666ab2e56 Tree-SHA512: eaee003f7a99154822c5b5efbc62008d32c1efbecc6fec6e183427f6b2ae5d30b3be7924e3a7271b1a1de91517f5bd2a70011d45358c3105c6a0702f12b70f7c
2021-08-12[addrman] Make addrman consistency checks a runtime optionJohn Newbery
Currently addrman consistency checks are a compile time option, and are not enabled in our CI. It's unlikely anyone is running these consistency checks. Make them a runtime option instead, where users can enable addrman consistency checks every n operations (similar to mempool tests). Update the addrman unit tests to do internal consistency checks every 100 operations (checking on every operations causes the test runtime to increase by several seconds). Also assert on a failed addrman consistency check to terminate program execution.
2021-08-09Merge bitcoin/bitcoin#22337: wallet: Use bilingual_str for errorsSamuel Dobson
92993aa5cf37995e65e68dfd6f129ecaf418e01c Change SignTransaction's input_errors to use bilingual_str (Andrew Chow) 171366e89b828a557f8262d9dc14ff7a03f813f7 Use bilingual_str for address fetching functions (Andrew Chow) 9571c69b51115454c6a699be9492024f7b46c2b4 Add bilingual_str::clear() (Andrew Chow) Pull request description: In a couple of places in the wallet, errors are `std::string`. In order for these errors to be translated, change them to use `bilingual_str`. ACKs for top commit: hebasto: re-ACK 92993aa5cf37995e65e68dfd6f129ecaf418e01c, only rebased since my [previous](https://github.com/bitcoin/bitcoin/pull/22337#pullrequestreview-694542729) review, verified with klementtan: Code review ACK 92993aa5cf37995e65e68dfd6f129ecaf418e01c meshcollider: Code review ACK 92993aa5cf37995e65e68dfd6f129ecaf418e01c Tree-SHA512: 5400e419dd87db8c49b67ed0964de2d44b58010a566ca246f2f0760ed9ef6a9b6f6df7a6adcb211b315b74c727bfe8c7d07eb5690b5922fa5828ceef4c83461f
2021-08-07fuzz: Re-enable assert in banman againMarcoFalke
2021-08-06fuzz: Avoid OOM in system fuzz targetMarcoFalke
2021-08-05[tests] Make deterministic addrman use nKey = 1John Newbery
addrman_tests fail when consistency checks are enabled, since the tests set the deterministic test addrman's nKey value to zero, which is an invalid value. Change this so that deterministic addrman's nKey value is set to 1. This requires updating a few tests that are using magic values derived from nKey being set to 0.
2021-08-05[addrman] Add deterministic argument to CAddrMan ctorJohn Newbery
Removes the need for tests to update nKey and insecure_rand after constructing a CAddrMan.
2021-08-05Merge bitcoin/bitcoin#21129: fuzz: check that ser+unser produces the same ↵MarcoFalke
AddrMan 87651795d8622d354f8e3c481eb868d9433b841c fuzz: check that ser+unser produces the same AddrMan (Vasil Dimov) 6408b24517f3418e2a408071b4c2ce26571f3167 fuzz: move init code to the CAddrManDeterministic constructor (Vasil Dimov) Pull request description: Add a fuzz test that fills addrman with a pile of randomly generated addresses, serializes it to a stream, unserializes the stream to another addrman object and compares the two. Some discussion of this already happened at https://github.com/jnewbery/bitcoin/pull/18. ACKs for top commit: practicalswift: cr ACK 87651795d8622d354f8e3c481eb868d9433b841c jonatack: ACK 87651795d8622d354f8e3c481eb868d9433b841c rebased to current master, reviewed, fuzz build, ran `FUZZ=addrman_serdeser src/test/fuzz/fuzz` Tree-SHA512: 7eda79279f14f2649840bf752e575d7b02cbaad541f74f7254855ebd4a32da988f042d78aa9228983350283bb74dd0c71f51f04c0846889c3ba2f19f01a0c303