aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2021-01-12Add bitcoin-util command line utilityAnthony Towns
2020-12-14rpc: allow getblocktemplate for test chains when unconnected or in IBDAnthony Towns
2020-12-14rpc: update getblocktemplate with signet rule, include signet_challengeAnthony Towns
2020-12-14Merge #20617: p2p: Remove m_is_manual_connection from CNodeStatefanquake
a33442fdc73eabd1c5596ab92954344edc9517e6 Remove m_is_manual_connection from CNodeState (Antoine Riard) Pull request description: Currently, this member is only used to exclude MANUAL peers from discouragement in MaybePunishNodeForBlock(). Manual connections are already protected in MaybeDiscourageAndDisconnect(), independently from their network processing behaviors. ACKs for top commit: MarcoFalke: cr ACK a33442fdc73eabd1c5596ab92954344edc9517e6 promag: Code review ACK a33442fdc73eabd1c5596ab92954344edc9517e6. jnewbery: utACK a33442fdc73eabd1c5596ab92954344edc9517e6 amitiuttarwar: code review ACK a33442fdc73eabd1c5596ab92954344edc9517e6 Tree-SHA512: cfe3f3dfa131373e3299002d34ae9e22ca6e1a966831bab32fcf06ff1d08f06095b4ab020cc4d267f3ec05ae23fbdc22373382ab828b999c0db11b8c842a4f0c
2020-12-13Merge #20588: Remove unused and confusing CTransaction constructorfanquake
fac39c198324715565897f4240709340477af0bf wallet: document that tx in CreateTransaction is purely an out-param (MarcoFalke) faac31521bb7ecbf999541cf918d3750ff589de4 Remove unused and confusing CTransaction constructor (MarcoFalke) Pull request description: The constructor is confusing and dangerous (as explained in the TODO), fix that by removing it. ACKs for top commit: laanwj: Code review ACK fac39c198324715565897f4240709340477af0bf promag: Code review ACK fac39c198324715565897f4240709340477af0bf. theStack: Code review ACK fac39c198324715565897f4240709340477af0bf Tree-SHA512: e0c8cffce8d8ee0166b8e1cbfe85ed0657611e26e2af0d69fde70eceaa5d75cbde3eb489af0428fe4fc431360b4c791fb1cc21b8dee7d4c7a4f17df00836229d
2020-12-12Merge #20079: p2p: Treat handshake misbehavior like unknown messageMarcoFalke
faaad1bbac46cfeb22654b4c59f0aac7a680c03a p2p: Ignore version msgs after initial version msg (MarcoFalke) fad68afcff731153d1c83f7f56c91ecbb264b59a p2p: Ignore non-version msgs before version msg (MarcoFalke) Pull request description: Handshake misbehaviour doesn't cost us more than any other unknown message, so it seems odd to treat it differently ACKs for top commit: jnewbery: utACK faaad1bbac46cfeb22654b4c59f0aac7a680c03a practicalswift: ACK faaad1bbac46cfeb22654b4c59f0aac7a680c03a: patch looks correct Tree-SHA512: 9f30c3b5c1f6604fd02cff878f10999956152419a3dd9825f8267cbdeff7d06787418b41c7fde8a00a5e557fe89204546e05d5689042dbf7b07fbb7eb95cddff
2020-12-12Merge #20275: wallet: List all wallets in non-SQLite and non-BDB buildsMarcoFalke
f3d870fc2271bf45e0269e5ae135bced1a26f620 wallet: List all wallets in non-SQLite or non-BDB builds (Russell Yanofsky) d70dc89e78ee6355e0bc37cc36cfc04ef7a86885 refactor: Consolidate redundant wallet database path and exists functions (Russell Yanofsky) 6a7a63644cd2fc56538d323cc0d5c1d7945247fd refactor: Drop call to GetWalletEnv in wallet salvage code (Russell Yanofsky) 6ee9cbdd18a70894f89dd268c276d5eb47a34827 refactor: Replace ListWalletDir() function with ListDatabases() (Russell Yanofsky) 5aaeb6cf877055c47fa2bbd2ea5e8d3d2033933b MOVEONLY: Move IsBDBFile, IsSQLiteFile, and ListWalletDir (Russell Yanofsky) Pull request description: This PR does not change behavior when bitcoin is built normally with both the SQLite and BDB libraries. It just makes non-SQLite and non-BDB builds more similar to the normal build. Specifically: - It makes wallet directory lists always include all wallets so wallets don't appear missing depending on the build. - It now triggers specific "Build does not support SQLite database format" and "Build does not support Berkeley DB database format" errors if a wallet can't be loaded instead of the more ambiguous and scary "Data is not in recognized format" error. Both changes are implemented in the last commit. The previous commits are just refactoring cleanups that make the last commit possible and consolidate and reduce code. ACKs for top commit: achow101: ACK f3d870fc2271bf45e0269e5ae135bced1a26f620 promag: Tested ACK f3d870fc2271bf45e0269e5ae135bced1a26f620. Tested a --without-sqlite build with sqlite wallets. Tree-SHA512: 029ad21559dbc338b5f351d05113c51bc25bce830f4f4e18bcd82287bc528275347a60249da65b91d252632aeb70b25d057bd59c704bfcaafb9f790bc5b59762
2020-12-11Merge #19858: Periodically make block-relay connections and sync headersMarcoFalke
b3a515c0bec97633a76bec101af47c3c90c0b749 Clarify comments around outbound peer eviction (Suhas Daftuar) daffaf03fbede6c01287779e464379ee3acb005a Periodically make block-relay connections and sync headers (Suhas Daftuar) 3cc8a7a0f5fa183cd7f0cf5e56f16f9a9d1f2441 Use conn_type to identify block-relay peers, rather than m_tx_relay == nullptr (Suhas Daftuar) 91d61952a82af3e8887e8ae532ecc19d87fe9073 Simplify and clarify extra outbound peer counting (Suhas Daftuar) Pull request description: To make eclipse attacks more difficult, regularly initiate outbound connections and stay connected long enough to sync headers and potentially learn of new blocks. If we learn a new block, rotate out an existing block-relay peer in favor of the new peer. This augments the existing outbound peer rotation that exists -- currently we make new full-relay connections when our tip is stale, which we disconnect after waiting a small time to see if we learn a new block. As block-relay connections use minimal bandwidth, we can make these connections regularly and not just when our tip is stale. Like feeler connections, these connections are not aggressive; whenever our timer fires (once every 5 minutes on average), we'll try to initiate a new block-relay connection as described, but if we fail to connect we just wait for our timer to fire again before repeating with a new peer. ACKs for top commit: ariard: Code Review ACK b3a515c, only change since last time is dropping a useless `cs_main` taking. I manually tested a previous version of the PR, and not substantial change has been introduced since then which would alter behavior IMO. jonatack: Tested ACK b3a515c0bec97633a76bec101af47c3c90c0b749 over several weeks, though this change and behavior could benefit from test coverage and other follow-ups (refactoring, etc.) described in the review feedback. I did not verify the behavior of `m_start_extra_block_relay_peers` only being enabled after initial chain sync. Since my last review, one unneeded `cs_main` lock was removed. Tree-SHA512: 75fc6f8e8003e88e93f86b845caf2d30b8b9c0dbb0a6b8aabe4e24ea4f6327351f736a068a3b2720a8a581b789942a3a47f921e2afdb47e88bc50d078aa37b6f
2020-12-10test: Fix inconsistent lock order in wallet_tests/CreateWalletHennadii Stepanov
2020-12-10[skip ci] sync: Check precondition in LEAVE_CRITICAL_SECTION() macroHennadii Stepanov
This change reveals a bug in the wallet_tests/CreateWalletFromFile test, that will be fixed in the following commit.
2020-12-10sync: Improve CheckLastCritical()Hennadii Stepanov
This commit adds actual lock stack logging if check fails.
2020-12-10Remove m_is_manual_connection from CNodeStateAntoine Riard
Currently, this member is only used to exclude MANUAL peers from discouragement in MaybePunishNodeForBlock(). Manual connections are already protected in MaybeDiscourageAndDisconnect(), independently from their network processing behaviors.
2020-12-10Clarify comments around outbound peer evictionSuhas Daftuar
2020-12-10Periodically make block-relay connections and sync headersSuhas Daftuar
To make eclipse attacks more difficult, regularly initiate outbound connections and stay connected long enough to sync headers and potentially learn of new blocks. If we learn a new block, rotate out an existing block-relay peer in favor of the new peer. This augments the existing outbound peer rotation that exists -- currently we make new full-relay connections when our tip is stale, which we disconnect after waiting a small time to see if we learn a new block. As block-relay connections use minimal bandwidth, we can make these connections regularly and not just when our tip is stale. Like feeler connections, these connections are not aggressive; whenever our timer fires (once every 5 minutes on average), we'll try to initiate a new block-relay connection as described, but if we fail to connect we just wait for our timer to fire again before repeating with a new peer.
2020-12-10Use conn_type to identify block-relay peers, rather than m_tx_relay == nullptrSuhas Daftuar
2020-12-10Simplify and clarify extra outbound peer countingSuhas Daftuar
2020-12-10Merge #20589: log: Clarify that failure to read/write fee_estimates.dat is ↵Wladimir J. van der Laan
non-fatal fa0d8359b351fd179a0a2f458671a4d7828c9a80 log: Clarify that failure to read fee_estimates.dat is non-fatal (MarcoFalke) faefa5db5f1d95b772873f4429e8a8fbb4e71cf3 log: Clarify that failure to write fee_estimates.dat is non-fatal (MarcoFalke) Pull request description: two minor logging fixups ACKs for top commit: practicalswift: ACK fa0d8359b351fd179a0a2f458671a4d7828c9a80: patch looks correct laanwj: Code review ACK fa0d8359b351fd179a0a2f458671a4d7828c9a80 Tree-SHA512: d1e7e595d3b4a5e497ee7ab70f3be5783dafec2726ef8e012db836c15e8e622022859a4472d6b516fe19d327737b25fdfb509cd9aeb022ca847b13c54e55800a
2020-12-10Merge #20595: Improve heuristic hex transaction decodingWladimir J. van der Laan
0f949cde3dff15170db7930b0f7345ff995c267d Add regression test for incorrect decoding (Pieter Wuille) 39c42c442044aef611d03ee7053d2dd6df63deb7 Improve heuristic hex transaction decoding (Pieter Wuille) Pull request description: The current hex tx decoding logic will refuse to decode valid extended-encoded transactions if the result fails the heuristic sanity check, even when the legacy-encoding fails. Fix this. Fixes #20579 ACKs for top commit: achow101: Code review ACK 0f949cde3dff15170db7930b0f7345ff995c267d jonatack: Tested ACK 0f949cde3dff15170db7930b0f7345ff995c267d laanwj: Code review ACK 0f949cde3dff15170db7930b0f7345ff995c267d Tree-SHA512: bd6dc80d824eb9a87026a623be910cac92173f8ce1c8b040c2246348c3cf0c6d64bcc40127b859e5e4da1efe88cf02a6945f7ebb91079799395145cb09d9c7a5
2020-12-10Merge #20573: wallet, bugfix: allow send with string fee_rate amountsMarcoFalke
6fa72ceb8021c3b5aea62f6cfe92665c29212923 test: add coverage for passing fee rate as a string (Jon Atack) ce207d6b93d35bc02fcd2dd28f1fd95869261d43 wallet, bugfix: allow send to take string fee rate values (Jon Atack) Pull request description: RPC send currently only accepts fee rates as numbers, which is a user-facing bug. It should accept fee rates as an amount, e.g. a string or a number, as documented in its help and like sendtoaddress, sendmany, fundrawtransaction, walletcreatefundedpsbt, and bumpfee. Provide a fix and regression test coverage. ACKs for top commit: MarcoFalke: review ACK 6fa72ceb8021c3b5aea62f6cfe92665c29212923 achow101: Code review ACK 6fa72ceb8021c3b5aea62f6cfe92665c29212923 promag: Code review ACK 6fa72ceb8021c3b5aea62f6cfe92665c29212923. Tree-SHA512: 735f9269cb1b81953764b5283449c0b154bd62de034225be5bcedc515c84faf767fe8fe0741008679fe412922c847b00d116cb11aab775236b779c847ba87167
2020-12-10Merge #19776: net, rpc: expose high bandwidth mode state via getpeerinfoMarcoFalke
343dc4760fd2407895fc8b3417a504b194429156 test: add test for high-bandwidth mode states in getpeerinfo (Sebastian Falbesoner) dab6583307ceb7dd94affcc3482ddcc1a5747147 doc: release note for new getpeerinfo fields "bip152_hb_{from,to}" (Sebastian Falbesoner) a7ed00f8bbc07dfc09f9e0a5bae10a1afe7612bb rpc: expose high-bandwidth mode states via getpeerinfo (Sebastian Falbesoner) 30bc8fab6833e0447ceadd3fff1566a680e33a98 net: save high-bandwidth mode states in CNodeStats (Sebastian Falbesoner) Pull request description: Fixes #19676, "_For every peer expose through getpeerinfo RPC whether or not we selected them as HB peers, and whether or not they selected us as HB peers._" See [BIP152](https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki), in particular the [protocol flow diagram](https://github.com/bitcoin/bips/raw/master/bip-0152/protocol-flow.png). The newly introduced states are changed on the following places in the code: * on reception of a `SENDCMPCT` message with valid version, the field `m_highbandwidth_from` is changed depending on the first integer parameter in the message (1=high bandwidth, 0=low bandwidth), i.e. it just mirrors the field `CNodeState.fPreferHeaderAndIDs`. * after adding a `SENDCMPCT` message to the send queue, the field `m_highbandwidth_to` is changed depending on how the first integer parameter is set (same as above) Note that after receiving `VERACK`, the node also sends `SENDCMPCT`, but that is only to announce the preferred version and never selects high-bandwidth mode, hence there is no need to change the state variables there, which are initialized to `false` anyways. ACKs for top commit: naumenkogs: reACK 343dc4760fd2407895fc8b3417a504b194429156 jonatack: re-ACK 343dc4760fd2407895fc8b3417a504b194429156 per `git range-diff 7ea6499 4df1d12 343dc47` Tree-SHA512: f4999e6a935266812c2259a9b5dc459710037d3c9e938006d282557cc225e56128f72965faffb207fc60c6531fab1206db976dd8729a69e8ca29d4835317b99f
2020-12-10Merge #20217: net: Remove g_relay_txesMarcoFalke
34e33ab8592d757b3acfe812c20d235029bbc319 Remove g_relay_txes (John Newbery) 68334b39443b3cfd75b0ef815ac40074185386f2 [net processing] Add m_ignores_incoming_txs to PeerManager and use internally (John Newbery) 4d510aa055064df5a10c2cc7888baffc3e6bc0e6 [init] Use MakeUnique<> to construct peerman (John Newbery) f3f61d0eb937ada5fd00d7d590f5f29325f7f414 [net processing] Add IgnoresIncomingTxs() function to PeerManager (John Newbery) 5805b8299f8f4943114de53c4dc09fc2dd9e270b [net processing] Move PushNodeVersion into PeerManager (John Newbery) Pull request description: `g_relay_txes` is only required inside net_processing and is set only once at startup. Instead of having a global, move it to be a const member of PeerManager. This requires moving `PushNodeVersion()` into `PeerManager`, which also allows us to remove the `connman` argument. ACKs for top commit: narula: utACK 34e33ab8592d757b3acfe812c20d235029bbc319 MarcoFalke: re-ACK 34e33ab85 💐 Tree-SHA512: 33f75b522e5f34b243731932eb96cd6c8ce9db69b5186395e3718858bc715cec1711a663c6afc5880462812cbc15040930e2dc648b2acad6bc6502ad1397c5e3
2020-12-09Merge #20603: build: Update crc32c subtreeWladimir J. van der Laan
90c0f267bdedc261d8fdab188e96ca58c206652a Squashed 'src/crc32c/' changes from 224988680f..b5ef9be675 (MarcoFalke) Pull request description: Except for the ARM64 darwin fix this is just code-shuffling in files/functions we don't use ACKs for top commit: jonasschnelli: Tested ACK fa7c8d136f6590e54d60c37fb34ebec8da84ebbb - Tested this on an ARM Mac. Linking issue went away (successful depends compilation). Also tested that the ARM64 hardware acceleration code part was used. laanwj: Code review ACK fa7c8d136f6590e54d60c37fb34ebec8da84ebbb Tree-SHA512: 1fa156d72c75d22ead2677b165e566978331f795d52a637e478d83d1cf2adddd84eed259d617df6d11270af2e4e57ae6991aec3bc4c0bdf5dec959f44daa14eb
2020-12-09Remove g_relay_txesJohn Newbery
Also remove vestigial commend in init.cpp
2020-12-09[net processing] Add m_ignores_incoming_txs to PeerManager and use internallyJohn Newbery
2020-12-09[init] Use MakeUnique<> to construct peermanJohn Newbery
2020-12-09[net processing] Add IgnoresIncomingTxs() function to PeerManagerJohn Newbery
2020-12-09[net processing] Move PushNodeVersion into PeerManagerJohn Newbery
2020-12-09Merge #20602: util: Allow use of C++14 chrono literalsMarcoFalke
fa11110bff6288f63e0c487e2e4b4079fb0f4569 util: Allow use of C++14 chrono literals (MarcoFalke) Pull request description: I think we should allow the use of chrono literals for new code to make it less verbose. Obviously old code can stay as-is. This patch pulls in the needed namespace and replaces some lines for illustrative purposes. ACKs for top commit: vasild: ACK fa11110bff6288f63e0c487e2e4b4079fb0f4569 jonatack: ACK fa11110bff6288f63e0c487e2e4b4079fb0f4569 Tree-SHA512: ee2b72c8f28dee07b33b9a8ee8f7c87c0bc43b05c56a17b786cf9803ef204c7628e01b02de1af1a4eb01f5cdf6fc336f69c2833e17acd606ebda20ac6917e6bb
2020-12-09Merge #20606: Remove unused bits from service flags enumWladimir J. van der Laan
fa40168ab3102b9ad850f967a0e7fa22dbfbd0c6 Remove unused bits from service flags enum (MarcoFalke) Pull request description: Remove service bits that haven't been observed on the active network for years and won't ever be observed on the network with this meaning. Keeping this dead assignment in our source code forever doesn't add any value. I somehow forgot to do this in commit fa0d0ff6e1bee60fde63724ae28a51aac5a94d4a. ACKs for top commit: laanwj: Code review ACK fa40168ab3102b9ad850f967a0e7fa22dbfbd0c6 practicalswift: cr ACK fa40168ab3102b9ad850f967a0e7fa22dbfbd0c6 fanquake: ACK fa40168ab3102b9ad850f967a0e7fa22dbfbd0c6 Tree-SHA512: 376e5ac05940493cf2209fea60515c843e978c4b476f2524f6bf7a37a646d237c3ddcf6c0fa23641f9ba550f625609703d9b51b4be631a7f2a90e1092b557232
2020-12-09Merge #19910: net processing: Move peer_map to PeerManagerfanquake
3025ca9e7743d9b96c22e9c6ed7ef051dcea7e54 [net processing] Add RemovePeer() (John Newbery) a20ab22786466fe5164b53e62de9d23a4062fbca [net processing] Make GetPeerRef const (John Newbery) ed7e469ceec6f7101a3fb7b15c21a6fb69697866 [net_processing] Move peer_map to PeerManager (John Newbery) a529fd3e3f2391e592ac937e291fec51e067ea2e [net processing] Move GetNodeStateStats into PeerManager (John Newbery) Pull request description: This moves `g_peer_map` from a global in net_processing.cpp's unnamed namespace to being a member `m_peer_map` of `PeerManager`. ACKs for top commit: theuni: Re-ACK 3025ca9e7743d9b96c22e9c6ed7ef051dcea7e54. dongcarl: Re-ACK 3025ca9 hebasto: re-ACK 3025ca9e7743d9b96c22e9c6ed7ef051dcea7e54, since my [previous](https://github.com/bitcoin/bitcoin/pull/19910#pullrequestreview-545574237) review only reverted the change that introduced NRVO in `PeerManager::GetPeerRef`, and comments are fixed in the proper commits. Tree-SHA512: 6369eb3c688ac5b84f89f7674115f78ff02edbed76063ac2ebb1759894c9e973883e10821a35dab92bd3d738280acc095bd5368f552a060b83cd309330387d47
2020-12-09Merge #20323: tests: Create or use existing properly initialized NodeContextsMarcoFalke
81137c60fe6234569e1c5e6760f3a6f016956944 test: Add new ChainTestingSetup and use it (Carl Dong) 7e9e7fe56734d729ed7de39e880577b135dfd368 qt/test: [FIX] Add forgotten Context setting in RPCNestedTests (Carl Dong) Pull request description: This is part 1/n of the effort to [de-globalize `ChainstateManager`](https://github.com/bitcoin/bitcoin/pull/20158) Reviewers: Looking for tested/Code-Review/plain-ACKs ### Context In many of our tests, we manually instantiate `NodeContext`s or `ChainstateManager`s in the test code, which is error prone. Instead, we should create or use existing references because: 1. Before we [de-globalize `ChainstateManager`](https://github.com/bitcoin/bitcoin/pull/20158), much of our code still acts on `g_chainman` (our global `ChainstateManager`), sometimes even when you're calling a method on a specific instance of `ChainstateManager`! This means that we may act on two instances of `ChainstateManager`, which is most likely not what we want. 2. Using existing references (initialized by the `{Basic,}TestingSetup` constructors) means that you're acting on objects which are properly initialized, instead of "just initialized enough for this dang test to pass". Also, they're already there! It's free! 3. By acting on the right object, we also allow the review-only assertions in future commits of [de-globalize `ChainstateManager`](https://github.com/bitcoin/bitcoin/pull/20158) to work and demonstrate correctness. Some more detailed debugging notes can be found in the first commit, reproduced below: ``` Previously, the validation_chainstatemanager_tests test suite instantiated its own duplicate ChainstateManager on which tests were performed. This wasn't a problem for the specific actions performed in that suite. However, the existence of this duplicate ChainstateManager and the fact that many of our validation static functions reach for g_chainman, ::Chain(state|)Active means we may end up acting on two different CChainStates should we write more extensive tests in the future. This change adds a new ChainTestingSetup which performs all initialization previously done by TestingSetup except: 1. Mempool sanity check frequency setting 2. ChainState initialization 3. Genesis Activation 4. {Ban,Conn,Peer}Man initialization Means that we will no longer need to initialize a duplicate ChainstateManger in order to test the initialization codepaths of CChainState and ChainstateManager. Lastly, this change has the additional benefit of allowing for review-only assertions meant to show correctness to work in future work de-globalizing g_chainman. In the test chainstatemanager_rebalance_caches, an additional LoadGenesisBlock call is added as MaybeReblanaceCaches eventually calls FlushBlockFile, which tries to access vinfoBlockFile[nLastBlockFile], which is out of bounds when LoadGenesisBlock hasn't been called yet. ----- Note for the future: In a previous version of this change, I put ChainTestingSetup between BasicTestingSetup and TestingSetup such that TestingSetup inherited from ChainTestingSetup. This was suboptimal, and showed how the class con/destructor inheritance structure we have for these TestingSetup classes is probably not the most suitable abstraction. In particular, for both TestingSetup and ChainTestingSetup, we need to stop the scheduler first before anything else. Otherwise classes depending on the scheduler may be referenced by the scheduler after said classes are freed. This means that there's no clear parallel between our teardown code and C++'s destructuring order for class hierarchies. Future work should strive to coalesce (as much as possible) test and non-test init codepaths and perhaps structure it in a more fail-proof way. ``` ACKs for top commit: MarcoFalke: ACK 81137c60fe looking excellent now 🐩 jnewbery: ACK 81137c60fe6234569e1c5e6760f3a6f016956944 ryanofsky: Code review ACK 81137c60fe6234569e1c5e6760f3a6f016956944. This change is simpler after the rebase because wallet & bench commits are dropped. Tree-SHA512: a8d84f08f2db6428b0b88449bdc814c9db35b7559156d536dfebd3225c2707dba65959e76d2152e3f8c96eacbf1e0b0000f745edf1e196deddb97ff1ef360953
2020-12-09Merge #20564: Don't send 'sendaddrv2' to pre-70016 software, and send before ↵MarcoFalke
'verack' 1583498fb6781c01ca2f33c09319ed793964c574 Send and require SENDADDRV2 before VERACK (Pieter Wuille) c5a89196602e43ebb1cdc9cd4f08d153419c13e1 Don't send 'sendaddrv2' to pre-70016 software (Pieter Wuille) Pull request description: BIP155 defines addrv2 and sendaddrv2 for all protocol versions, but some implementations reject messages they don't know. As a courtesy, don't send it to nodes with a version before 70016, as no software is known to support BIP155 that doesn't announce at least that protocol version number. Also move the sending of sendaddrv2 earlier (before sending verack), as proposed in https://github.com/bitcoin/bips/pull/1043. This has the side effect that local address broadcast of torv3 will work (as it'll only trigger after we know whether or not the peer supports addrv2). ACKs for top commit: MarcoFalke: ACK 1583498fb6781c01ca2f33c09319ed793964c574 jnewbery: ACK 1583498fb6781c01ca2f33c09319ed793964c574 jonatack: ACK 1583498fb6781c01ca2f33c09319ed793964c574 vasild: ACK 1583498 Tree-SHA512: 3bd5833fa8c8567b6dedd99e4a9b6bb71c127aa66d5284b217503c86d597dc59aa7382c41f3a4bf561bb658b89db81d1a7703a700eef4ffc17cb916660e23a82
2020-12-08test: Add new ChainTestingSetup and use itCarl Dong
Previously, the validation_chainstatemanager_tests test suite instantiated its own duplicate ChainstateManager on which tests were performed. This wasn't a problem for the specific actions performed in that suite. However, the existence of this duplicate ChainstateManager and the fact that many of our validation static functions reach for g_chainman, ::Chain(state|)Active means we may end up acting on two different CChainStates should we write more extensive tests in the future. This change adds a new ChainTestingSetup which performs all initialization previously done by TestingSetup except: 1. RPC command registration 2. ChainState initialization 3. Genesis Activation 4. {Ban,Conn,Peer}Man initialization Means that we will no longer need to initialize a duplicate ChainstateManger in order to test the initialization codepaths of CChainState and ChainstateManager. Lastly, this change has the additional benefit of allowing for review-only assertions meant to show correctness to work in future work de-globalizing g_chainman. In the test chainstatemanager_rebalance_caches, an additional LoadGenesisBlock call is added as MaybeReblanaceCaches eventually calls FlushBlockFile, which tries to access vinfoBlockFile[nLastBlockFile], which is out of bounds when LoadGenesisBlock hasn't been called yet. ----- Note for the future: The class con/destructor inheritance structure we have for these TestingSetup classes is probably not the most suitable abstraction. In particular, for both TestingSetup and ChainTestingSetup, we need to stop the scheduler first before anything else. Otherwise classes depending on the scheduler may be referenced by the scheduler after said classes are freed. This means that there's no clear parallel between our teardown code and C++'s destructuring order for class hierarchies. Future work should strive to coalesce (as much as possible) test and non-test init codepaths and perhaps structure it in a more fail-proof way.
2020-12-08qt/test: [FIX] Add forgotten Context setting in RPCNestedTestsCarl Dong
2020-12-08build: Update crc32c subtreeMarcoFalke
2020-12-08Improve heuristic hex transaction decodingPieter Wuille
Whenever both encodings are permitted, try both, and if only one succeeds, return that one. Otherwise prefer the one for which the heuristic sanity check passes. If that is the case for neither or for both, return the extended-permitting deserialization.
2020-12-08Merge #19425: refactor: Get rid of more redundant chain methodsMarcoFalke
5baa88fd38c8efa0e361636bb2c60af89d27b5d5 test: Remove no longer needed MakeChain calls (Russell Yanofsky) 6965f1352d2d7086d308750ce83a84f191a17755 refactor: Replace uses ChainActive() in interfaces/chain.cpp (Russell Yanofsky) 3fbbb9a6403a86fbed3d5d9f7939998922593377 refactor: Get rid of more redundant chain methods (Russell Yanofsky) Pull request description: This just drops three interfaces::Chain methods replacing them with other calls. Motivation for removing these chain methods: - Need to get rid of findFirstBlockWithTimeAndHeight for #10102, which doesn't support overloaded methods - Followup from https://github.com/bitcoin/bitcoin/pull/16426#discussion_r412487403 - phantomcircuit comments about findNextBlock test http://www.erisian.com.au/bitcoin-core-dev/log-2020-06-06.html#l-214 Behavior is not changing in any way here. A TODO comment in ScanForWalletTransactions was removed, but just because it was invalid (see https://github.com/bitcoin/bitcoin/pull/19195#discussion_r448020762), not because it was implemented. ACKs for top commit: MarcoFalke: re-ACK 5baa88fd38c8efa0e361636bb2c60af89d27b5d5 🕶 dongcarl: ACK 5baa88fd38c8efa0e361636bb2c60af89d27b5d5 Tree-SHA512: d20a2a8cf8742e6100c6d3a4871ed67f184925712cf9e55d301abee60353bf3f74cd0d46a13be1715d1c2faef72102bb321654d08a128c2ef6880f72b72a6687
2020-12-08Send and require SENDADDRV2 before VERACKPieter Wuille
See the corresponding BIP change: https://github.com/bitcoin/bips/pull/1043
2020-12-08Remove unused bits from service flags enumMarcoFalke
2020-12-08Squashed 'src/crc32c/' changes from 224988680f..b5ef9be675MarcoFalke
b5ef9be675 Merge #1: Merge changes from upstream 9e7f512430 Merge remote-tracking branch 'origin/master' into bitcoin-fork 1f85030246 Add support for ARM64 darwin (#43) 3bb959c982 Remove unnecessary reinterpret_cast (#42) 2e97ab26b1 Fix (unused) ReadUint64LE for BE machines (#41) 47b40d2209 Bump dependencies. (#40) ba74185625 Move CI to Visual Studio 2019. efa301a7e5 Allow different C/C++ standards when this is used as a subproject. cc6d71465e CMake: Use configure_package_config_file() git-subtree-dir: src/crc32c git-subtree-split: b5ef9be6755a2e61e2988bb238f13d1c0ee1fa0a
2020-12-08util: Allow use of C++14 chrono literalsMarcoFalke
2020-12-07test: Remove no longer needed MakeChain callsRussell Yanofsky
These calls are no longer needed after edc316020e8270dafc5e31465d532baebdafd3dd from #19098 which started instantiating BasicTestingSetup.m_node.chain Patch from MarcoFalke <falke.marco@gmail.com> in https://github.com/bitcoin/bitcoin/pull/19425#discussion_r526701954 Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2020-12-07Merge #20561: p2p: periodically clear m_addr_knownWladimir J. van der Laan
65273fa0e74f0c11dfbf0645dd962bdc779ea558 Clear m_addr_known before our periodic self-advertisement (Suhas Daftuar) Pull request description: We use a rolling bloom filter to track which addresses we've previously sent a peer, but after #7125 we no longer clear it every day before our own announcement. This looks to me like an oversight which has the effect of reducing the frequency with which we actually self-announce our own address, so this reintroduces resetting that filter. ACKs for top commit: naumenkogs: ACK 65273fa0e74f0c11dfbf0645dd962bdc779ea558 laanwj: Code review ACK 65273fa0e74f0c11dfbf0645dd962bdc779ea558 sipa: utACK 65273fa0e74f0c11dfbf0645dd962bdc779ea558 Tree-SHA512: 602c155fb6d2249b054fcb6f1c0dd17143605ceb87132286bbd90babf26d258ff6c41f9925482c17e2be41805d33f9b83926cb447f394969ffecd4bccfa0a64f
2020-12-07Don't send 'sendaddrv2' to pre-70016 softwarePieter Wuille
2020-12-07wallet: document that tx in CreateTransaction is purely an out-paramMarcoFalke
2020-12-07Remove unused and confusing CTransaction constructorMarcoFalke
2020-12-07log: Clarify that failure to read fee_estimates.dat is non-fatalMarcoFalke
An uppercase "ERROR" in the log might indicate a fatal error. Though, all read-failures for fee_estimates.dat are non-fatal, so avoid the "ERROR". Before: ERROR: CBlockPolicyEstimator::Read(): up-version (149900) fee estimate file After: CBlockPolicyEstimator::Read(): unable to read policy estimator data (non-fatal): up-version (149900) fee estimate file
2020-12-07refactor: Replace uses ChainActive() in interfaces/chain.cppRussell Yanofsky
Suggested https://github.com/bitcoin/bitcoin/pull/19425#discussion_r456236407
2020-12-07Merge #20568: doc: Use FeeModes doc helper in estimatesmartfeeWladimir J. van der Laan
fa8abdc9953e381715493b259908e246914793b0 rpc: Use FeeModes doc helper in estimatesmartfee (MarcoFalke) Pull request description: Not sure why this doesn't use the doc helper, probably an oversight? ACKs for top commit: laanwj: Code review ACK fa8abdc9953e381715493b259908e246914793b0 Tree-SHA512: 1f2dc8356e3476ddcf9cafafa7f9865ad95bed1e3067c0edab8e3c483e374bdbdbecc066167554b4a1b479e28f6a52c4ae6a75a70c67ee4e1ff4f3ba36b04001
2020-12-07refactor: Get rid of more redundant chain methodsRussell Yanofsky
This just drops three interfaces::Chain methods replacing them with other calls. Motivation for removing these chain methods: - Need to get rid of findFirstBlockWithTimeAndHeight for #10102, which doesn't support overloaded methods - Followup from https://github.com/bitcoin/bitcoin/pull/16426#discussion_r412487403 - phantomcircuit comments about findNextBlock test http://www.erisian.com.au/bitcoin-core-dev/log-2020-06-06.html#l-214 Behavior is not changing in any way here. A TODO comment in ScanForWalletTransactions was removed, but just because it was invalid (see https://github.com/bitcoin/bitcoin/pull/19195#discussion_r448020762), not because it was implemented.