aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2023-02-01Add CCoinsViewCache::SanityCheck() and use it in fuzz testPieter Wuille
2023-02-01Add simulation-based CCoinsViewCache fuzzerPieter Wuille
The fuzzer goes through a sequence of operations that get applied to both a real stack of CCoinsViewCache objects, and to simulation data, comparing the two at the end.
2023-02-01Merge bitcoin/bitcoin#26910: wallet: migrate wallet, exit early if no legacy ↵Andrew Chow
data exist 6d31900e52efa2c7c7a220d8c8ad6353c412a2aa wallet: migrate wallet, exit early if no legacy data exist (furszy) Pull request description: The process first creates a backup file then return an error, without removing the recently created file, when notices that the db is already running sqlite. ACKs for top commit: john-moffett: ACK 6d31900e52efa2c7c7a220d8c8ad6353c412a2aa achow101: ACK 6d31900e52efa2c7c7a220d8c8ad6353c412a2aa ishaanam: crACK 6d31900e52efa2c7c7a220d8c8ad6353c412a2aa Tree-SHA512: 9fb52e80de96e129487ab91bef13647bc4570a782003b1e37940e2a00ca26283fd24ad39bdb63a984ae0a56140b518fd0d74aa2fc59ab04405b2c179b7d3c54a
2023-02-01Merge bitcoin/bitcoin#27015: p2p: 26847 fixups (AddrMan totals)fanquake
dc70c1eb08ba8f0e77ac0810312a67468ade9419 addrman: Use std::nullopt instead of {} (Martin Zumsande) 59cc66abb945c11f30fa571899127275528c5fce test: Remove AddrMan unit test that fails consistency checks (Martin Zumsande) Pull request description: Two fixups for #26847: * Now that `AddrMan::Size()` performs internal consistency tests (it didn't before), we can't call it in the `load_addrman_corrupted` unit tests, where we deal with an artificially corrupted `AddrMan`. This would fail the test when using `-checkaddrman=1` (leading to spurious CI fails). Therefore remove the tests assertion, which is not particularly helpful anyway (in production we abort init when peers.dat is corrupted instead of querying AddrMan in its corrupted state). (See https://github.com/bitcoin/bitcoin/pull/26847#issuecomment-1411458339) * Use `std::nullopt` instead of `{}` for default args (suggested in https://github.com/bitcoin/bitcoin/pull/26847#discussion_r1090643603) ACKs for top commit: MarcoFalke: lgtm ACK dc70c1eb08ba8f0e77ac0810312a67468ade9419 Tree-SHA512: dd8a988e23d71a66d3dd30560bb653c9ad17db6915abfa5f722818b0ab18921051ec9223bfbc75d967df8bcd204dfe473d680bf68e8a8e4e4998fbb91dc973c5
2023-02-01Merge bitcoin/bitcoin#26935: refactor: Fix clang-tidy ↵fanquake
readability-const-return-type violations fa451d4b60ee0538b3ea6b946740a64734b35b6d Fix clang-tidy readability-const-return-type violations (MarcoFalke) Pull request description: This comes up during review, so instead of wasting review cycles on this, just enforce it via CI ACKs for top commit: stickies-v: utACK fa451d4b6 hebasto: ACK fa451d4b60ee0538b3ea6b946740a64734b35b6d. Tree-SHA512: 144a85612f00ec43f7ea1fdaa11901ca981a9f0465a8849745712d741b201b9c3307118172ee0b8efd12bebf25bc6f32a6e2c908495e371f9ada0a917994f44e
2023-02-01addrman: Use std::nullopt instead of {}Martin Zumsande
2023-02-01test: Remove AddrMan unit test that fails consistency checksMartin Zumsande
Now that Size() performs internal consistency checks, it will rightfully fail (and assert) when dealing with a corrupted AddrMan. Therefore remove this check.
2023-02-01Merge bitcoin/bitcoin#27010: refactor: use `Hash` helpers for double-SHA256 ↵MarcoFalke
calculations 87f11ef47fea31d51bcc3f5df68f78fb28e3d8dd refactor: use `Hash` helper for double-SHA256 calculations (Sebastian Falbesoner) Pull request description: We have two helper templates `Hash(const T& in1)` and `Hash(const T& in1, const T& in2)` available for calculating the double-SHA256 hash of one object or two concatenated objects, respectively: https://github.com/bitcoin/bitcoin/blob/b5868f4b1f884e8d6612f34ca4005fe3a992053d/src/hash.h#L74-L89 This PR uses them in order to increase readability and simplify the code. As in #15294 (which inspired this PR, doing the same for RIPEMD160), the helper is not utilized in validation.cpp and script/interpreter.cpp to avoid touching consensus-relevant code. ACKs for top commit: john-moffett: ACK 87f11ef47fea31d51bcc3f5df68f78fb28e3d8dd stickies-v: ACK 87f11ef47fea31d51bcc3f5df68f78fb28e3d8dd MarcoFalke: review ACK 87f11ef47fea31d51bcc3f5df68f78fb28e3d8dd 😬 Tree-SHA512: 11d7e3d00c89685107784010fbffb33ccafb4d1b6a76c4dceb937b29bb234ef4d54581b16bd0737c8d2994a90cf4fe10a9738c7cc5b6d085c6a819f06176dab9
2023-02-01Merge bitcoin/bitcoin#26991: doc: followups to #26471glozow
47c174d8ce4c5f36c41203aedde86c5f0da90217 doc: NetPermissionFlags for tx relay in blocksonly (willcl-ark) e325e0fccba4981d28053b79473ddaa44355e6e8 doc: Fix comment syntax error (willcl-ark) Pull request description: Fix syntax error and specify `NetPermissionFlags` for whitelisted tx relay ACKs for top commit: w0xlt: ACK https://github.com/bitcoin/bitcoin/pull/26991/commits/47c174d8ce4c5f36c41203aedde86c5f0da90217 Tree-SHA512: eb579dc599a96a3ea79c01ac3e76160ec59cf71c2486c9401da8fbbd96ae756ba647aa9ba874835946bc76ba02782729da788617f982ae5a852139e10e7dfd75
2023-02-01Merge bitcoin/bitcoin#25974: test, build: Separate `read_json` function into ↵fanquake
its own module 7a820cee0e6408f5848799011d82dd29ee7fa8c5 test, build: Separate `read_json` function into its own module (Hennadii Stepanov) Pull request description: Currently, 4 source files rely on the definition of the `read_json` function provided in `src/test/script_tests.cpp`. This PR breaks this entanglement, improves code structure and maintainability. ACKs for top commit: fanquake: ACK 7a820cee0e6408f5848799011d82dd29ee7fa8c5 Tree-SHA512: f1567989f76cb54ab86cc48927851a8c424b08a9483d02d4918b629e0c792108bad4ccf7fa341d57b0921d91e84bf8fa3b9c07e5fdf12c64d9d5da83e4e464fb
2023-02-01Fix clang-tidy readability-const-return-type violationsMarcoFalke
2023-02-01Merge bitcoin/bitcoin#26705: clang-tidy: Fix ↵MarcoFalke
`modernize-use-default-member-init` in headers and force to check all headers b0e916913cedb8154419ec818bb9094a72fc8379 clang-tidy: Force to check all headers (Hennadii Stepanov) 96ee992ac3535848e2dc717bf284339badd40dcb clang-tidy: Fix `modernize-use-default-member-init` in headers (Hennadii Stepanov) Pull request description: This PR: - fixes the only [remained](https://github.com/bitcoin/bitcoin/pull/26705#issuecomment-1353742082) check in headers, i.e., `modernize-use-default-member-init` - forces `clang-tidy` check all headers Closes bitcoin/bitcoin#26703. ACKs for top commit: MarcoFalke: review ACK b0e916913cedb8154419ec818bb9094a72fc8379 🍹 Tree-SHA512: 4d33fe873094914541ae81968cdb4e7a7a01b3fdd4f25bc6daa8a53f45dab80565a5b3607ddc338f122369ca5a0a2d0d09c8e78cabe1beb6bd50c115bc5c5210
2023-02-01Merge bitcoin/bitcoin#26888: net: simplify the call to vProcessMsg.splice()MarcoFalke
dfc01ccd73e1f12698278d467c241f398da9fc7d net: simplify the call to vProcessMsg.splice() (Vasil Dimov) Pull request description: At the time when ```cpp pnode->vProcessMsg.splice(pnode->vProcessMsg.end(), pnode->vRecvMsg, pnode->vRecvMsg.begin(), it); ``` is called, `it` is certainly `pnode->vRecvMsg.end()` which makes the call equivalent to: ```cpp pnode->vProcessMsg.splice(pnode->vProcessMsg.end(), pnode->vRecvMsg, pnode->vRecvMsg.begin(), pnode->vRecvMsg.end()); ``` which is equivalent to: ```cpp pnode->vProcessMsg.splice(pnode->vProcessMsg.end(), pnode->vRecvMsg); ``` Thus, use the latter. Further, maybe irrelevant, but the latter has constant complexity while the original code is `O(length of vRecvMsg)`. ACKs for top commit: theStack: Code-review ACK dfc01ccd73e1f12698278d467c241f398da9fc7d MarcoFalke: review ACK dfc01ccd73e1f12698278d467c241f398da9fc7d 🐑 jonatack: Light review ACK dfc01ccd73e1f12698278d467c241f398da9fc7d Tree-SHA512: 9f4eb61d1caf4af9a61ba2f54b915fcfe406db62c58ab1ec42f736505b6792e9379a83d0458d6cc04f289edcec070b7c962f94a920ab51701c3cab103152866f
2023-01-31Merge bitcoin/bitcoin#26847: p2p: track AddrMan totals by network and table, ↵Andrew Chow
improve precision of adding fixed seeds 80f39c99ef2d30e3e2d8dbc068d25cf92aa32344 addrman, refactor: combine two size functions (Amiti Uttarwar) 4885d6f197736cb89fdfac250b280ec10829d903 addrman, refactor: move count increment into Create() (Martin Zumsande) c77c877a8e916878e09f64b2faa12eeca7528cc8 net: Load fixed seeds from reachable networks for which we don't have addresses (Martin Zumsande) d35595a78a4a6cae72d3204c1ec3f82f77a10d56 addrman: add function to return size by network and table (Martin Zumsande) Pull request description: AddrMan currently doesn't track the number of its entries by network, it only knows the total number of addresses. This PR makes AddrMan keep track of these numbers, which would be helpful for multiple things: 1. Allow to specifically add fixed seeds to AddrMan of networks where we don't have any addresses yet - even if AddrMan as a whole is not empty (partly fixing #26035). This is in particular helpful if the user abruptly changes `-onlynet` settings (such that addrs that used to be reachable are no longer and vice versa), in which case they currently could get stuck and not find any outbound peers. The second commit of this PR implements this. 1. (Future work): Add logic for automatic connection management with respect to networks - such as making attempts to have at least one connection to each reachable network as suggested [here](https://github.com/bitcoin/bitcoin/issues/26035#issuecomment-1249420209). This would involve requesting an address from a particular network from AddrMan, and expanding its corresponding function `AddrMan::Select()` to do this requires internal knowledge of the current number of addresses for each network and table to avoid getting stuck in endless loops. 1. (Future work): Perhaps display the totals to users. At least I would find this helpful to debug, the existing option (`./bitcoin-cli -addrinfo`) is rather indirect by doing the aggregation itself in each call, doesn't distinguish between new and tried, and being based on `AddrMan::GetAddr()` it's also subject to a quality filter which we probably don't want in this spot. ACKs for top commit: naumenkogs: utACK 80f39c9 stratospher: ACK 80f39c9 achow101: ACK 80f39c99ef2d30e3e2d8dbc068d25cf92aa32344 vasild: ACK 80f39c99ef2d30e3e2d8dbc068d25cf92aa32344 Tree-SHA512: 6359f2e3f4db7c120c0789d92d74cb7d87a2ceedb7d6a34b5eff20c7f55c5c81092d10ed94efe29afc1c66947820a0d9c14876ee0c8d1f8e068a6df4e1131927
2023-01-31refactor: use `Hash` helper for double-SHA256 calculationsSebastian Falbesoner
2023-01-31Merge bitcoin/bitcoin#23670: build: Build minisketch test in `make check`, ↵fanquake
not in `make` 6d58117a31a88eec3f0a103f9d1fc26cf0b48348 build: Build minisketch test in `make check`, not in `make` (Hennadii Stepanov) Pull request description: On master (d1e42659bbdd8da170542d8c638242cd94f71a7d): ``` $ ./autogen.sh && ./configure --without-gui --disable-wallet && make clean $ make 2>&1 | grep LD | grep -v .la CXXLD bitcoind CXXLD bitcoin-cli CXXLD bitcoin-tx CXXLD bitcoin-util CXXLD test/test_bitcoin CXXLD bench/bench_bitcoin CXXLD minisketch/test CXXLD test/fuzz/fuzz CXXLD univalue/test/object CXXLD univalue/test/unitester $ make check 2>&1 | grep LD CCLD exhaustive_tests CCLD tests ``` With this PR: ``` $ ./autogen.sh && ./configure --without-gui --disable-wallet && make clean $ make 2>&1 | grep LD | grep -v .la CXXLD bitcoind CXXLD bitcoin-cli CXXLD bitcoin-tx CXXLD bitcoin-util CXXLD test/test_bitcoin CXXLD bench/bench_bitcoin CXXLD test/fuzz/fuzz CXXLD univalue/test/object CXXLD univalue/test/unitester $ make check 2>&1 | grep LD CXXLD minisketch/test CCLD exhaustive_tests CCLD tests ``` In fact, this PR restores behavior that was before bitcoin/bitcoin#22646, and that behavior looks more optimal. As an outcome, the `contrib/guix/libexec/build.sh` does not spend resources to build binaries which are not a part of the release package. ACKs for top commit: TheCharlatan: ACK 6d58117a31a88eec3f0a103f9d1fc26cf0b48348 Tree-SHA512: 4957c8f88a01aca005813bf4c1c26f433756bf68ea0c958481c638ead229fa8e23ecae3a8ac31ea555876ba6f2cc10ecd91caf2e2f664de5cb529ec05fb38fa7
2023-01-31Merge bitcoin/bitcoin#26974: refactor: rpc: set TxToJSON default verbosity ↵MarcoFalke
to SHOW_DETAILS a24e633339c45eaca28fc7af0488956332ac300c refactor: rpc: set TxToJSON default verbosity to SHOW_DETAILS (stickies-v) Pull request description: `TxToJSON()` and `TxToUniv()` are only to be called when we want to decode the transaction (i.e. its details) into JSON. If `TxVerbosity` is `SHOW_TXID`, the function should not have been (and currently is not) called in the first place. There is no behaviour change, current logic simply assumes anything less than `TxVerbosity::SHOW_DETAILS_AND_PREVOUT` equals `TxVerbosity::SHOW_DETAILS`. With this change, the assumptions and intent become more explicit. ACKs for top commit: w0xlt: ACK https://github.com/bitcoin/bitcoin/pull/26974/commits/a24e633339c45eaca28fc7af0488956332ac300c Tree-SHA512: b97235adae49b972bdbe10aca1438643fb35ec66a4e57166b1975b3015bc5a06a711feebe4453a8fefe71781e484b21ef80847d8e8a33694a3abcc863accd4d7
2023-01-31clang-tidy: Force to check all headersHennadii Stepanov
2023-01-31clang-tidy: Fix `modernize-use-default-member-init` in headersHennadii Stepanov
See https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-default-member-init.html
2023-01-30Add assertions that BatchWrite(erase=true) erasesPieter Wuille
2023-01-30Avoid unclear {it = ++it;}Pieter Wuille
2023-01-30Follow coding style for named argumentsPieter Wuille
2023-01-30Make test/fuzz/coins_view exercise CCoinsViewCache::Sync()Pieter Wuille
2023-01-30Merge bitcoin/bitcoin#26965: refactor: Remove stray cs_main redundant ↵fanquake
declaration faba08b5b4dd5dedb457db18696de6e15839c696 refactor: Remove stray cs_main redundant declaration (MarcoFalke) fa02591edff0255c5120b5acb2366542a61c251f doc: Export threadsafety.h from sync.h (MarcoFalke) Pull request description: Looks like this was forgotten when introducing kernel/cs_main ? Also, there is a commit to export threadsafety.h from sync.h. ACKs for top commit: hebasto: ACK faba08b5b4dd5dedb457db18696de6e15839c696 Tree-SHA512: 0aa58e7693b6fcd504f9da7339f8baa463a6407f67b27f68002db705f4642321ac3765f16c3d906c925ee24085591b79160a62fa5f4aaf6f2e5dcc788411800d
2023-01-30Merge bitcoin/bitcoin#17487: coins: allow write to disk without cache dropfanquake
1d7935b45ac61791399989effc18aece8b368fbb test: add test for coins view flush behavior using Sync() (James O'Beirne) 2c3cbd6c007a588e667751024027462268626fdb test: add use of Sync() to coins tests (James O'Beirne) 6d8affca96c7a34f5f104c5a3122e7420ffc083c test: refactor: clarify the coins simulation (James O'Beirne) 79cedc36afe2e72e42839d861734d73d545d21b8 coins: add Sync() method to allow flush without cacheCoins drop (James O'Beirne) Pull request description: This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11): Parent PR: #15606 Issue: #15605 Specification: https://github.com/jamesob/assumeutxo-docs/tree/master/proposal --- In certain circumstances, we may want to flush chainstate data to disk without emptying `cacheCoins`, which affects performance. UTXO snapshot activation is one such case, as we populate `cacheCoins` with the snapshot contents and want to persist immediately afterwards but also enter IBD. See also #15265, which makes the case that under normal operation a flush-without-erase doesn't necessarily add much benefit. I open this PR even in light of the previous discussion because (i) flush-without-erase almost certainly provides benefit in the case of snapshot activation (especially on spinning disk hardware) and (ii) this diff is fairly small and gives us convenient options for more granular cache management without changing existing policy. See also #15218. ACKs for top commit: sipa: ACK 1d7935b45ac61791399989effc18aece8b368fbb achow101: ACK 1d7935b45ac61791399989effc18aece8b368fbb Sjors: tACK 1d7935b45ac61791399989effc18aece8b368fbb Tree-SHA512: 897583963e98661767d2d09c9a22f6019da24125558cd88770bfe2d017d924f23a9075b729e4b1febdec5b0709a38e8fa1ef94d62aa88650556b06cb4826c845
2023-01-30Merge bitcoin/bitcoin#26649: refactor: Use AutoFile and HashVerifier ↵fanquake
(without ser-type and ser-version) where possible eeee61065fe165dcce9625f7cc4cfce9e432aafa Use AutoFile and HashVerifier where possible (MarcoFalke) fa961141f7fc515fbb6fcb9d8417108034b256ce Add HashVerifier (MarcoFalke) Pull request description: This was done in the context of https://github.com/bitcoin/bitcoin/pull/25284 , but I think it also makes sense standalone. The basic idea is that serialization type should not be initialized when it is not needed. Same for the serialization version. So do this here for `AutoFile` and `HashVerifier`. `CAutoFile` and `CHashVerifier` remain in places where it is not yet possible. ACKs for top commit: stickies-v: ACK eeee61065fe165dcce9625f7cc4cfce9e432aafa Tree-SHA512: 93786778c309ecfdc1ed43552d24ff9d966954d69a47f66faaa6de24daacd25c651f3f62bde5abbb362700298fb3c04ffbd3207a0dd13d0bd8bff7fd6d07dcf8
2023-01-30Merge bitcoin/bitcoin#26896: build: Remove port-forwarding runtime setting ↵fanquake
options from configure d51f0fa4b7b19281efe65aacf414845c661d0a13 doc: add release notes for 26896 (fanquake) 2b248798d96f794db08b7725730b5fb4e00b9b10 build: remove --enable-upnp-default from configure (fanquake) 02f5a5e7b5fd7ba35e407d4409202a0e0fed003c build: remove --enable-natpmp-default from configure (fanquake) 25a0e8ba0b31d8bd265df0589fe49241a60d0fc2 Remove configure-time setting of DEFAULT_UPNP (fanquake) 06562e5fa771dab275a9cab4914cd64d961a52bc Remove configure-time setting of DEFAULT_NATPMP (fanquake) Pull request description: This PR removes the `--enable-upnp-default` and `--enable-natpmp-default` options from configure. It's odd to me that we maintain configure-time options for setting the default port-forwarding runtime state (but no other similar options), and I'm not sure what use-case it satisfies, that can't be achieved by multiple other means. I also doubt that we'll ever restart using these in release builds, or turning on any of this by default. I think the only scenario these options would be used is when you want to compile your own binaries (we don't use them in Guix), with port-forwarding on by default, but otherwise can't or don't want to use a `.conf` file, can't or don't want to pass command line options at runtime, and also don't want to modify the source code? ACKs for top commit: hebasto: ACK d51f0fa4b7b19281efe65aacf414845c661d0a13, rebased and comments have been addressed since my recent [review](https://github.com/bitcoin/bitcoin/pull/26896#pullrequestreview-1273910740). TheCharlatan: ACK d51f0fa4b7b19281efe65aacf414845c661d0a13 Tree-SHA512: 481decd8bddd8b03b7319591e3acf189f7b6b96c9a9a8c5bc1a3f8ec00d0b8f9b52d2f5c28a298a2ec947cfe9611cfd184e393ccb2e4e21bfce86ca7d4de60d3
2023-01-30doc: Fix comment syntax errorwillcl-ark
2023-01-30net: simplify the call to vProcessMsg.splice()Vasil Dimov
At the time when ```cpp pnode->vProcessMsg.splice(pnode->vProcessMsg.end(), pnode->vRecvMsg, pnode->vRecvMsg.begin(), it); ``` is called, `it` is certainly `pnode->vRecvMsg.end()` which makes the call equivalent to: ```cpp pnode->vProcessMsg.splice(pnode->vProcessMsg.end(), pnode->vRecvMsg, pnode->vRecvMsg.begin(), pnode->vRecvMsg.end()); ``` which is equivalent to: ```cpp pnode->vProcessMsg.splice(pnode->vProcessMsg.end(), pnode->vRecvMsg); ``` Thus, use the latter. Further, maybe irrelevant, but the latter has constant complexity while the original code is `O(length of vRecvMsg)`.
2023-01-30Merge bitcoin/bitcoin#26499: wallet: Abandon descendants of orphaned coinbasesglozow
b0fa5989e1b77a343349bd36f8bc407f9366a589 test: Check that orphaned coinbase unconf spend is still abandoned (Andrew Chow) 9addbd78901124a48fd41a82a9557fcf3490191d wallet: Automatically abandon orphaned coinbases and their children (Andrew Chow) Pull request description: When a block is reorged out of the main chain, any descendants of the coinbase will no longer be valid. Currently they are only marked as inactive, which means that our balance calculations will still include them. In order to be excluded from the balance calculation, they need to either be abandoned or conflicted. This PR goes with the abandoned method. Note that even when they are included in balance calculations, coin selection will not select outputs belonging to these transactions because they are not in the mempool. Fixes #14148 ACKs for top commit: furszy: ACK b0fa5989 with a not-blocking nit. aureleoules: reACK b0fa5989e1b77a343349bd36f8bc407f9366a589 ishaanam: ACK b0fa5989e1b77a343349bd36f8bc407f9366a589 Tree-SHA512: 68f12e7aa8df392d8817dc6ac0becce8dbe83837bfa538f47027e6730e5b2e1b1a090cfcea2dc598398fdb66090e02d321d799f087020d7e1badcf96e598c3ac
2023-01-30Merge bitcoin/bitcoin#26982: p2p: 25880 fixups (stalling timeout)MarcoFalke
b2a1e477444bfb90328b353e89967ace6ef10918 net_processing: simplify logging statement (Martin Zumsande) 6548ba68e85298c01b983c2392aab86e88e447d3 test: fix intermittent errors in p2p_ibd_stalling.py (Martin Zumsande) Pull request description: Two small fixups to #25880: - Use `is_connected` instead of `num_test_p2p_connections` to avoid intermittent failures where the p2p MiniNode got disconnected but this info hasn't made it to python yet, so it fails a ping. (https://github.com/bitcoin/bitcoin/pull/25880#discussion_r1089217720) - Simplify a logging statement (suggested in https://github.com/bitcoin/bitcoin/pull/25880#discussion_r1013738635) ACKs for top commit: MarcoFalke: review ACK b2a1e477444bfb90328b353e89967ace6ef10918 🕧 Tree-SHA512: 337f0883bf1c94cc26301a80dfa649093ed1e211ddda1acad8449a2add5be44e5c12d6073c209df9c7aa1edb9da33ec1cfdcb0deafd76178ed78785843e80bc7
2023-01-30Merge bitcoin/bitcoin#15294: refactor: Extract RipeMd160MarcoFalke
6879be691bf636a53208ef058f2ebe18bfa8017c refactor: Extract RIPEMD160 (Ben Woosley) Pull request description: To directly return a CRIPEMD160 hash from data. Simplifies the call sites. ACKs for top commit: achow101: ACK 6879be691bf636a53208ef058f2ebe18bfa8017c theStack: re-ACK 6879be691bf636a53208ef058f2ebe18bfa8017c MarcoFalke: review ACK 6879be691bf636a53208ef058f2ebe18bfa8017c 🏔 Tree-SHA512: 6ead85d8060c2ac6afd43ec716ff5a82d6754c4132fe7df3b898541fa19f1dfd8b301b2b66ae7cb7594b1b1a8c7f68bce3790a8c610d4a1164e995d89bc5ae34
2023-01-29net_processing: simplify logging statementMartin Zumsande
Also use count_seconds() instead of count() for type safety.
2023-01-28Remove configure-time setting of DEFAULT_UPNPfanquake
Default to false.
2023-01-28Remove configure-time setting of DEFAULT_NATPMPfanquake
Default to false.
2023-01-27Merge bitcoin/bitcoin#26900: refactor: Add BlockManager gettersMarcoFalke
faf7b4f1fc35f1488567e0e4a57ecb348596b992 Add BlockManager::IsPruneMode() (MarcoFalke) fae71fe27ec021583aaeac09aa924522bb63db05 Add BlockManager::GetPruneTarget() (MarcoFalke) fa0f0436d83288262d7d764b1d239c1a6de6146f Add BlockManager::LoadingBlocks() (MarcoFalke) Pull request description: Requested in https://github.com/bitcoin/bitcoin/pull/25781#discussion_r1061323795, but adding getters seems unrelated from removing globals, so I split it out for now. ACKs for top commit: dergoegge: Code review ACK faf7b4f1fc35f1488567e0e4a57ecb348596b992 brunoerg: crACK faf7b4f1fc35f1488567e0e4a57ecb348596b992 Tree-SHA512: 204d0e9a0e8b78175482f89b4ce620fba0e65d8e49ad845d187af44d3843f4c733a01bac1ffe5a5319f524d8346123693a456778b69d6c75268c447eb8839642
2023-01-27test, build: Separate `read_json` function into its own moduleHennadii Stepanov
2023-01-27Merge bitcoin/bitcoin#25880: p2p: Make stalling timeout adaptive during IBDAndrew Chow
39b93649c4b98cd82c64b957fd9f6a6fd3c2a359 test: add functional test for IBD stalling logic (Martin Zumsande) 0565951f34e6d155dc825964c5d8b1dd00931682 p2p: Make block stalling timeout adaptive (Martin Zumsande) Pull request description: During IBD, there is the following stalling mechanism if we can't proceed with assigning blocks from a 1024 lookahead window because all of these blocks are either already downloaded or in-flight: We'll mark the peer from which we expect the current block that would allow us to advance our tip (and thereby move the 1024 window ahead) as a possible staller. We then give this peer 2 more seconds to deliver a block (`BLOCK_STALLING_TIMEOUT`) and if it doesn't, disconnect it and assign the critical block we need to another peer. Now the problem is that this second peer is immediately marked as a potential staller using the same mechanism and given 2 seconds as well - if our own connection is so slow that it simply takes us more than 2 seconds to download this block, that peer will also be disconnected (and so on...), leading to repeated disconnections and no progress in IBD. This has been described in #9213, and I have observed this when doing IBD on slower connections or with Tor - sometimes there would be several minutes without progress, where all we did was disconnect peers and find new ones. The `2s` stalling timeout was introduced in #4468, when blocks weren't full and before Segwit increased the maximum possible physical size of blocks - so I think it made a lot of sense back then. But it would be good to revisit this timeout now. This PR makes the timout adaptive (idea by sipa): If we disconnect a peer for stalling, we now double the timeout for the next peer (up to a maximum of 64s). If we connect a block, we half it again up to the old value of 2 seconds. That way, peers that are comparatively slower will still get disconnected, but long phases of disconnecting all peers shouldn't happen anymore. Fixes #9213 ACKs for top commit: achow101: ACK 39b93649c4b98cd82c64b957fd9f6a6fd3c2a359 RandyMcMillan: Strong Concept ACK 39b93649c4b98cd82c64b957fd9f6a6fd3c2a359 vasild: ACK 39b93649c4b98cd82c64b957fd9f6a6fd3c2a359 naumenkogs: ACK 39b93649c4b98cd82c64b957fd9f6a6fd3c2a359 Tree-SHA512: 85bc57093b2fb1d28d7409ed8df5a91543909405907bc129de7c6285d0810dd79bc05219e4d5aefcb55c85512b0ad5bed43a4114a17e46c35b9a3f9a983d5754
2023-01-26addrman, refactor: combine two size functionsAmiti Uttarwar
The functionality of the old size() is covered by the new Size() when no arguments are specified, so this does not change behavior. Co-authored-by: Martin Zumsande <mzumsande@gmail.com>
2023-01-26addrman, refactor: move count increment into Create()Martin Zumsande
Create() is only called in one spot, so this doesn't change behavior. Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
2023-01-26net: Load fixed seeds from reachable networks for which we don't have addressesMartin Zumsande
Previously, we'd only load fixed seeds if we'd not know any addresses at all. This change makes it possible to change -onlynet abruptly, e.g. from -onlynet=onion to -onlynet=i2p and still find peers.
2023-01-26addrman: add function to return size by network and tableMartin Zumsande
For now, the new functionality will be used in the context of querying fixed seeds. Other possible applications for future changes is the use in the context of making automatic connections to specific networks, or making more detailed info about addrman accessible via rpc.
2023-01-26refactor: Extract RIPEMD160Ben Woosley
To directly return a CRIPEMD160 hash from data. Incidentally, decoding this acronym: * RIPEMD -> RIPE Message Digest * RIPE -> RACE Integrity Primitives Evaluation * RACE -> Research and Development in Advanced Communications Technologies in Europe
2023-01-26refactor: rpc: set TxToJSON default verbosity to SHOW_DETAILSstickies-v
`TxToJSON()` and `TxToUniv()` are only to be called when we want to decode the transaction (i.e. its details) into JSON. If `TxVerbosity` is `SHOW_TXID`, the function should not have been (and currently is not) called in the first place. There is no behaviour change, current logic simply assumes anything less than `TxVerbosity::SHOW_DETAILS_AND_PREVOUT` equals `TxVerbosity::SHOW_DETAILS`. With this change, the assumptions and intent become more explicit.
2023-01-26Merge bitcoin/bitcoin#25296: Add DataStream without ser-type and ser-version ↵fanquake
and use it where possible fa035fe2d61d0c98d1bfd0153a0c3b5eb9d40de4 Remove unused CDataStream::SetType (MarcoFalke) fa29e73cdab82f98682821322cda89b1084ba887 Use DataStream where possible (MarcoFalke) fa9becfe1cea5040e7cea36324d1b0789cbbd25d streams: Add DataStream without ser-type and ser-version (MarcoFalke) Pull request description: This was done in the context of https://github.com/bitcoin/bitcoin/pull/25284 , but I think it also makes sense standalone. The basic idea is that serialization type should not be initialized when it is not needed. Same for the serialization version. So do this here for `DataStream`. `CDataStream` remains in places where it is not yet possible. ACKs for top commit: stickies-v: re-ACK [fa035fe](https://github.com/bitcoin/bitcoin/commit/fa035fe2d61d0c98d1bfd0153a0c3b5eb9d40de4) aureleoules: diff re-ACK fa035fe2d61d0c98d1bfd0153a0c3b5eb9d40de4 https://github.com/bitcoin/bitcoin/compare/fa0e6640bac8c6426af7c5744125c85c0f74b9e5..fa035fe2d61d0c98d1bfd0153a0c3b5eb9d40de4 Tree-SHA512: cb5e53d0df7c94319ffadc6ea1d887fc38516decaf43f0673396d79cc62d450a1a61173654a91b8c2b52d2cecea53fe4a500b8f6466596f35731471163fb051c
2023-01-26Merge bitcoin/bitcoin#26551: p2p: Track orphans by who provided themglozow
c58c249a5b694c88122589fedbef4e2f13f08bb4 net_processing: indicate more work to do when orphans are ready to reconsider (Anthony Towns) ecb0a3e4259b81d6bb74d59a58eb65552c17d8d8 net_processing: Don't process tx after processing orphans (Anthony Towns) c5837757068bf8ea3e5b6fdad82f69d1deb81545 net_processing: only process orphans before messages (Anthony Towns) be2304676bedcd15debcdc694549fdd2b255ba62 txorphange: Drop redundant originator arg from GetTxToReconsider (Anthony Towns) a4fe09973aa82210b98dcb4e4e9f11ef59780f9b txorphanage: index workset by originating peer (Anthony Towns) Pull request description: We currently process orphans by assigning them to the peer that provided a missing parent; instead assign them to the peer that provided the orphan in the first place. This prevents a peer from being able to marginally delay another peer's transactions and also simplifies the internal API slightly. Because we're now associating orphan processing with the peer that provided the orphan originally, we no longer process orphans immediately after receiving the parent, but defer until a future call to `ProcessMessage`. Based on #26295 ACKs for top commit: naumenkogs: utACK c58c249a5b694c88122589fedbef4e2f13f08bb4 glozow: ACK c58c249a5b694c88122589fedbef4e2f13f08bb4 mzumsande: Code Review ACK c58c249a5b694c88122589fedbef4e2f13f08bb4 Tree-SHA512: 3186c346f21e60440266a2a80a9d23d7b96071414e14b2b3bfe50457c04c18b1eab109c3d8c2a7726a6b10a2eda1f0512510a52c102da112820a26f5d96f12de
2023-01-26Remove unused CDataStream::SetTypeMarcoFalke
The last use was removed in the previous commit.
2023-01-26Use DataStream where possibleMarcoFalke
2023-01-26Merge bitcoin/bitcoin#26960: refactor: Remove c_str from util/checkMarcoFalke
fab958290b84037fad1d78ffb2bce34d2b0e8c36 refactor: Remove c_str from util/check (MarcoFalke) Pull request description: Seems confusing and fragile to require calling code to call `c_str()` when passing a read-only view of a std::string. Fix that by using std::string_view, which can be constructed from string literals and std::string. Also, remove the now unused `c_str()` from `src/wallet/bdb.cpp`. ACKs for top commit: stickies-v: ACK fab958290b84037fad1d78ffb2bce34d2b0e8c36 aureleoules: ACK fab958290b84037fad1d78ffb2bce34d2b0e8c36 theStack: ACK fab958290b84037fad1d78ffb2bce34d2b0e8c36 Tree-SHA512: ae39812c6bb8e2ef095e1b843774af2718f48404cb848c3e43b16d3c22240557d69d54a13a038a4a9c48b3ba0e4523e1f87abdd60f91486092f50fd43c0e8483
2023-01-25Merge bitcoin/bitcoin#26929: rpc: Throw more user friendly arg type check ↵fanquake
error (1.5/2) fafeddfe0e6748e9769ad3dd526a6c0eaf6f4aac rpc: Throw more user friendly arg type check error (MarcoFalke) Pull request description: The arg type check error doesn't list which arg (position or name) failed. Fix that. ACKs for top commit: stickies-v: ACK fafeddfe0e6748e9769ad3dd526a6c0eaf6f4aac - although I think the functional test isn't in a logical place (but not blocking) Tree-SHA512: 17425aa145aab5045940ec74fff28f0e3b2b17ae55f91c4bb5cbcdff0ef13732f8e31621d85964dc2c04333ea37dbe528296ac61be27541384b44e37957555c8