aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
AgeCommit message (Collapse)Author
2021-05-12scripted-diff: update noban documentation in net_processing.cppJon Atack
-BEGIN VERIFY SCRIPT- s() { git grep -l "$1" src/net_processing.cpp | xargs sed -i "s/$1/$2/g"; } s 'the noban permission' 'NetPermissionFlags::NoBan permission' s 'the NOBAN permission flag' 'NetPermissionFlags::NoBan permission' s 'noban permission' 'NetPermissionFlags::NoBan permission' -END VERIFY SCRIPT-
2021-05-12scripted-diff: rename NetPermissionFlags enumeratorsJon Atack
- drop redundant PF_ permission flags prefixes - drop ALL_CAPS naming per https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Renum-caps - rename IsImplicit to Implicit -BEGIN VERIFY SCRIPT- s() { git grep -l "$1" src | xargs sed -i "s/$1/$2/g"; } s 'PF_NONE' 'None' s 'PF_BLOOMFILTER' 'BloomFilter' s 'PF_RELAY' 'Relay' s 'PF_FORCERELAY' 'ForceRelay' s 'PF_DOWNLOAD' 'Download' s 'PF_NOBAN' 'NoBan' s 'PF_MEMPOOL' 'Mempool' s 'PF_ADDR' 'Addr' s 'PF_ISIMPLICIT' 'Implicit' s 'PF_ALL' 'All' -END VERIFY SCRIPT-
2021-05-12scripted-diff: add NetPermissionFlags scopes where not already presentJon Atack
-BEGIN VERIFY SCRIPT- s() { git grep -l "$1" -- 'src' ':!src/net_permissions.h' | xargs sed -i -E "s/([^:])$1/\1NetPermissionFlags::$1/"; } s 'PF_NONE' s 'PF_BLOOMFILTER' s 'PF_RELAY' s 'PF_FORCERELAY' s 'PF_DOWNLOAD' s 'PF_NOBAN' s 'PF_MEMPOOL' s 'PF_ADDR' s 'PF_ISIMPLICIT' s 'PF_ALL' -END VERIFY SCRIPT- Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2021-05-04[net processing] Add internal _RelayTransactions()John Newbery
Callers of the external RelayTransactions() no longer need to lock cs_main.
2021-04-25p2p: Limit m_block_inv_mutexMarcoFalke
2021-04-21Merge bitcoin/bitcoin#21719: refactor: Add and use EnsureConnman in rpc codeMarcoFalke
fafb68add5e16e8bd5b9428bcffcaee2639747cf refactor: Add and use EnsureConnman in rpc code (MarcoFalke) faabeb854a6e46b46e4f26b22dc2c81e68e2d863 refactor: Mark member functions const (MarcoFalke) Pull request description: This removes the 10 occurrences of `throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");` and replaces them with `EnsureConnman`. ACKs for top commit: jarolrod: re-ACK fafb68add5e16e8bd5b9428bcffcaee2639747cf theStack: ACK fafb68add5e16e8bd5b9428bcffcaee2639747cf ryanofsky: Code review ACK fafb68add5e16e8bd5b9428bcffcaee2639747cf Tree-SHA512: 84c63cfe31e548645d906f7191a3526c7bea99ed0d54c2a75c2041452a44fe149ede343d8e1943b0e7770816c828bb047dfec8bc541a1f2b89920a126ee54d68
2021-04-19remove executable flag for src/net_processing.cppSebastian Falbesoner
2021-04-17refactor: Mark member functions constMarcoFalke
2021-04-17Refactor ProcessNewBlock to reduce code duplicationR E Broadley
2021-04-13Merge #21575: refactor: Create blockstorage modulefanquake
fadcd3f78e1dd1acd7a774f8fad68dc471ff9e1f doc: Remove irrelevant link to GitHub (MarcoFalke) fa121b628d51bb0e25eb3fbd716881fa55527dc7 blockstorage: [refactor] Use chainman reference where possible (MarcoFalke) fa0c7d9ad24d3c9515d3f9c136af4071cbd79055 move-only: Move *Disk functions to blockstorage (MarcoFalke) fa91b2b2b3447a3645e7958c7dc4e1946a69cb9c move-only: Move AbortNode to shutdown (MarcoFalke) fa413f07a14744e7d7f7746e861aabd9cf938f61 move-only: Move ThreadImport to blockstorage (MarcoFalke) faf843c07f99f91603e08ea858f972516f1d669a refactor: Move load block thread into ChainstateManager (MarcoFalke) Pull request description: This picks up the closed pull request #21030 and is the first step toward fixing #21220. The basic idea is to move all disk access into a separate module with benefits: * Breaking down the massive files init.cpp and validation.cpp into logical units * Creating a standalone-module to reduce the mental complexity * Pave the way to fix validation related circular dependencies * Pave the way to mock disk access for testing, especially where it is performance critical (like fuzzing) ACKs for top commit: promag: Code review ACK fadcd3f78e, checked (almost) moved only changes. This is a nice tidy up change and doesn't change behavior. Easily reviewed commit by commit. jamesob: ACK fadcd3f78e1dd1acd7a774f8fad68dc471ff9e1f ([`jamesob/ackr/21575.1.MarcoFalke.refactor_create_blocksto`](https://github.com/jamesob/bitcoin/tree/ackr/21575.1.MarcoFalke.refactor_create_blocksto)) ryanofsky: Code review ACK fadcd3f78e1dd1acd7a774f8fad68dc471ff9e1f. New organization makes sense, moves extraneous things outside of validation.cpp. PR is also easy to review with helpfully split up moveonly commits. Tree-SHA512: 917996592b6d8f9998289d8cb2b1b78b23d1fdb3b07216c9caec1380df33baa09dc2c1e706da669d440b497e79c9c62a01ca20dc202df5ad974a75f3ef7a143b
2021-04-06doc: fixup -Wdocumentation issuesfanquake
2021-04-05move-only: Move *Disk functions to blockstorageMarcoFalke
Can be reviewed with the git options --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2021-04-05refactor: Remove negative lock annotations from globalsMarcoFalke
2021-04-01Merge #21198: net: Address outstanding review comments from PR20721W. J. van der Laan
5ed535a02f8f0a6f65bbe19f48a8c81f43298393 [net] Changes to RunInactivityChecks (John Newbery) Pull request description: Updates the RunInactivityChecks() function: - rename to ShouldRunInactivityChecks (https://github.com/bitcoin/bitcoin/pull/20721#discussion_r576394790) - take optional time now (https://github.com/bitcoin/bitcoin/pull/20721#discussion_r575895661) - call from within InactivityChecks (https://github.com/bitcoin/bitcoin/pull/20721#discussion_r575894665) - update comment (https://github.com/bitcoin/bitcoin/pull/20721#discussion_r575894343) - change ordering of inequality (https://github.com/bitcoin/bitcoin/pull/20721#discussion_r574925129) - ~make inline (https://github.com/bitcoin/bitcoin/pull/20721#discussion_r574903578)~ ACKs for top commit: laanwj: Code review ACK 5ed535a02f8f0a6f65bbe19f48a8c81f43298393 Tree-SHA512: e6ac8e8cce5cddc84a52a40c908634c25f58be74512d642840d7bd7fa65c3d90a0f46cc19e4865b3fae7c933138247f58356167a60a5c519305cfd6d05e51f51
2021-04-01[net] Changes to RunInactivityChecksJohn Newbery
- rename to ShouldRunInactivityChecks (https://github.com/bitcoin/bitcoin/pull/20721#discussion_r576394790) - take optional time now (https://github.com/bitcoin/bitcoin/pull/20721#discussion_r575895661) - call from within InactivityChecks (https://github.com/bitcoin/bitcoin/pull/20721#discussion_r575894665) - update comment (https://github.com/bitcoin/bitcoin/pull/20721#discussion_r575894343) - change ordering of inequality (https://github.com/bitcoin/bitcoin/pull/20721#discussion_r574925129)
2021-04-01Merge #21525: [Bundle 4.5/n] Followup fixups to bundle 4MarcoFalke
693414d27181cf967f787a2ca72344e52c58c7f0 node/ifaces: ChainImpl: Use an accessor for ChainMan (Carl Dong) 98c4e252f0d09bebb2e4ad3289407459c2cda5d5 node/ifaces: NodeImpl: Use an accessor for ChainMan (Carl Dong) 7e8b5ee814b0b8c34acb20637ed4fc988ccba555 validation: Make BlockManager::LookupBlockIndex const (Carl Dong) 88aead263c61d86e5f836028f517cfbf2a575498 node: Avoid potential UB by asserting assumptions (Carl Dong) 1dd8ed7a8491e51b76eeb236b15b794d9254f674 net_processing: Move comments to declarations (Carl Dong) 07156eb387ea580be5e2ce4a1744992ce7575903 node/coinstats: Replace #include with fwd-declaration (Carl Dong) 7b8e976cd5ac78a22f1be2b2fed8562c693af5d9 miner: Add chainstate member to BlockAssembler (Carl Dong) e62067e7bcad5a559899afff2e4a8e8b7e9f4301 Revert "miner: Pass in chainstate to BlockAssembler::CreateNewBlock" (Carl Dong) eede0647b06b6009080c4e536a2705e911d6ee19 Revert "scripted-diff: Invoke CreateNewBlock with chainstate" (Carl Dong) 0c1b2bc549aec77b247f0103652d883227841ac5 Revert "miner: Remove old CreateNewBlock w/o chainstate param" (Carl Dong) Pull request description: Chronological history of this changeset: 1. Bundle 4 (#21270) got merged 2. Posthumous reviews were posted 3. These changes were prepended in bundle 5 4. More reviews were added in bundle 5 5. Someone suggested that we split the prepended changes up to another PR 6. This is that PR In the future, I will just do posthumous review changes in another PR instead. I apologize for the confusion. Addresses posthumous reviews on bundle 4: - From jnewbery: - https://github.com/bitcoin/bitcoin/pull/21270#issuecomment-796738048 - I didn't fix this one, but I added a `TODO` comment so that we don't lost track of it - https://github.com/bitcoin/bitcoin/pull/21270#discussion_r592291225 - https://github.com/bitcoin/bitcoin/pull/21270#discussion_r592296942 - https://github.com/bitcoin/bitcoin/pull/21270#discussion_r592299738 - https://github.com/bitcoin/bitcoin/pull/21270#discussion_r592301704 - From MarcoFalke: - https://github.com/bitcoin/bitcoin/pull/21270#discussion_r593096212 - https://github.com/bitcoin/bitcoin/pull/21270#discussion_r593097032 - https://github.com/bitcoin/bitcoin/pull/21270#discussion_r593097867 - https://github.com/bitcoin/bitcoin/pull/21270#discussion_r593100570 Addresses reviews on bundle 5: - Checking chainman existence before locking cs_main - MarcoFalke - https://github.com/bitcoin/bitcoin/pull/21391#discussion_r596601776 - https://github.com/bitcoin/bitcoin/pull/21391#discussion_r596601876 - Appropriate locking, usage of chainman, and control flow in `src/node/interfaces.cpp` - MarcoFalke - https://github.com/bitcoin/bitcoin/pull/21391#discussion_r596601383 - jnewbery - https://github.com/bitcoin/bitcoin/pull/21391#discussion_r597029360 - https://github.com/bitcoin/bitcoin/pull/21391#discussion_r597029921 - ryanofsky - https://github.com/bitcoin/bitcoin/pull/21391#discussion_r597163828 - Style/comment formatting changes - jnewbery - https://github.com/bitcoin/bitcoin/pull/21391#discussion_r597026552 - https://github.com/bitcoin/bitcoin/pull/21391#discussion_r597027186 - Making LookupBlockIndex const - jnewbery - https://github.com/bitcoin/bitcoin/pull/21391#discussion_r597035062 ACKs for top commit: MarcoFalke: review ACK 693414d27181cf967f787a2ca72344e52c58c7f0 🛐 ryanofsky: Code review ACK 693414d27181cf967f787a2ca72344e52c58c7f0. I reviewed this previously as part of #21391. I am a fan of the increasingly complicated bundle numbering, and kind of hope there in the next round there is some way we can get bundles 5.333333 and 5.666667! jamesob: ACK 693414d27181cf967f787a2ca72344e52c58c7f0 ([`jamesob/ackr/21525.1.dongcarl.bundle_4_5_n_followup_f`](https://github.com/jamesob/bitcoin/tree/ackr/21525.1.dongcarl.bundle_4_5_n_followup_f)) Tree-SHA512: 9bdc199f70400d01764e1bd03c25bdb6cff26dcef60e4ca3b649baf8d017a2dfc1f058099067962b4b6ccd32d078002b1389d733039f4c337558cb70324c0ee3
2021-04-01Merge #21236: net processing: Extract `addr` send functionality into ↵MarcoFalke
MaybeSendAddr() 935d4889228e7e361c8b0020761fa0e08a55fb48 [net processing] Refactor MaybeSendAddr() (John Newbery) 01a79ff924b11f91796d4aa63c571897b047ac7d [net processing] Fix overindentation in MaybeSendAddr() (John Newbery) 38c0be5da3af17208b165e73cee7612d3670b038 [net processing] Refactor MaybeSendAddr() - early exits (John Newbery) c87423c58b5165de835a49bebd566538a70c07ab [net processing] Change MaybeSendAddr() to take a reference (John Newbery) ad719297f2ecdd2394eff668b3be7070bc9cb3e2 [net processing] Extract `addr` send functionality into MaybeSendAddr() (John Newbery) 4ad4abcf07efefafd439b28679dff8d6bbf62943 [net] Change addr send times fields to be guarded by new mutex (John Newbery) c02fa47baa517e17b5c43bde3902b1e410c1b93f [net processing] Only call GetTime() once in SendMessages() (John Newbery) Pull request description: This continues the work of moving application layer data into net_processing. It refactors `addr` send functionality into its own function `MaybeSendAddr()` and flattens/simplifies the code. Isolating and simplifying the addr handling code makes subsequent changes (which will move addr data and logic into net processing) easier to review. This is a pure refactor. There are no functional changes. For motivation of the project, see #19398. ACKs for top commit: sipa: utACK 935d4889228e7e361c8b0020761fa0e08a55fb48 hebasto: ACK 935d4889228e7e361c8b0020761fa0e08a55fb48, I have reviewed the code and it looks OK, I agree it can be merged. MarcoFalke: review ACK 935d4889228e7e361c8b0020761fa0e08a55fb48 🐑 Tree-SHA512: 4e9dc84603147e74f479a211b42bcf315bdf5d14c21c08cf0b17d6c252775b90b012f0e0d834f1a607ed63c7ed5c63d5cf49b134344e7b64a1695bfcff111c92
2021-03-31[net processing] Refactor MaybeSendAddr()John Newbery
Changes to make MaybeSendAddr simpler and easier to maintain/update: - assert invariant that node.vAddrToSend.size() can never exceed MAX_ADDR_TO_SEND - erase known addresses from vAddrToSend in one pass - no check for (vAddr.size() >= MAX_ADDR_TO_SEND) during iteration, since vAddr can never exceed MAX_ADDR_TO_SEND.
2021-03-30net_processing: Move comments to declarationsCarl Dong
Also: - Remove extraneous blank line
2021-03-30Merge #20228: addrman: Make addrman a top-level componentMarcoFalke
3fc06d3d7b43dc1143fe0850db23c4e7ffbfe682 [net] remove fUpdateConnectionTime from FinalizeNode (John Newbery) 7c4cc67c0c3c50df004ee53cac5b2884b7fbab29 [net] remove CConnman::AddNewAddresses (John Newbery) bcd7f30b7944892db7ae37069175804567bb0cdf [net] remove CConnman::MarkAddressGood (John Newbery) 8073673dbcb2744fcc9c011edf2d61388ca929cd [net] remove CConnman::SetServices (John Newbery) 392a95d393a9af01b53e5e68197e81968efb84fc [net_processing] Keep addrman reference in PeerManager (John Newbery) 1c25adf6d278eb1a1f018986a126d0eb8137e0ee [net] Construct addrman outside connman (John Newbery) Pull request description: Addrman is currently a member variable of connman. Make it a top-level component with lifetime owned by node.context, and add a reference to addrman in peerman. This allows us to eliminate some functions in connman that are simply forwarding requests to addrman, and simplifies the connman-peerman interface. By constructing the addrman in init, we can also add parameters to the ctor, which allows us to test it better. See #20233, where we enable consistency checking for addrman in our functional tests. ACKs for top commit: MarcoFalke: re-ACK 3fc06d3d7b43dc1143fe0850db23c4e7ffbfe682 only change is squash 🏀 vasild: ACK 3fc06d3d7b43dc1143fe0850db23c4e7ffbfe682 Tree-SHA512: 17662c65cbedcd9bd1c194914bc4bb4216f4e3581a06222de78f026d6796f1da6fe3e0bf28c2d26a102a12ad4fbf13f815944a297f000e3acf46faea42855e07
2021-03-29[net processing] Fix overindentation in MaybeSendAddr()John Newbery
Reviewer hint: review with `git diff --ignore-all-space`.
2021-03-29[net processing] Refactor MaybeSendAddr() - early exitsJohn Newbery
Add early exit guard clauses if node.RelayAddrsWithConn() is false or if current_time < node.m_next_addr_send. Add comments. This commit leaves some lines over-indented. Those will be fixed in a subsequent whitespace-only commit.
2021-03-29[net processing] Change MaybeSendAddr() to take a referenceJohn Newbery
Change name of CNode parameter to node now that it's no longer a pointer.
2021-03-29[net processing] Extract `addr` send functionality into MaybeSendAddr()John Newbery
Reviewer hint: review with `git diff --color-moved=dimmed-zebra --ignore-all-space`
2021-03-29[net] Change addr send times fields to be guarded by new mutexJohn Newbery
2021-03-29[net processing] Only call GetTime() once in SendMessages()John Newbery
We currently call GetTime() 4 times in SendMessages(). Consolidate this to once GetTime() call.
2021-03-23p2p: Don't send FEEFILTER in blocksonly modeMartin Zumsande
It is unnecessary to send FEEFILTER messages when we don't accept transactions from our peers.
2021-03-22[net] remove fUpdateConnectionTime from FinalizeNodeJohn Newbery
PeerManager can just call directly into CAddrMan::Connected() now.
2021-03-20[net] remove CConnman::AddNewAddressesJohn Newbery
It just forwards calls to CAddrMan::Add.
2021-03-20[net] remove CConnman::MarkAddressGoodJohn Newbery
It just forwards calls to CAddrMan::Good.
2021-03-20[net] remove CConnman::SetServicesJohn Newbery
It just forwards calls to CAddrMan::SetServices.
2021-03-20[net_processing] Keep addrman reference in PeerManagerJohn Newbery
2021-03-18style-only: Remove whitespaceMarcoFalke
Can be reviewed with --ignore-all-space
2021-03-18net: Simplify ProcessGetBlockData execution by removing send flag.Patrick Strateman
Setting the send flag to false can be replaced by simply returning.
2021-03-18log: Clarify that block request below NODE_NETWORK_LIMITED_MIN_BLOCKS ↵MarcoFalke
disconnects
2021-03-18Merge #21425: refactor: Pass PeerManagerImpl members only onceMarcoFalke
fa2a80bf12d87c1d8a1a98b2faa8eea6731aac0e refactor: Pass PeerManagerImpl members only once (MarcoFalke) Pull request description: Member variables are already passed to methods via `this`, so no need to pass them another time as function parameter. ACKs for top commit: jnewbery: utACK fa2a80bf12d87c1d8a1a98b2faa8eea6731aac0e amitiuttarwar: utACK fa2a80bf12d87c1d8a1a98b2faa8eea6731aac0e Tree-SHA512: 1743825c7560cc748235e3db03e4cea02ad1f670f1b898d7757da644f12693ba9bb2d3eb09b64b3d10dd2e68f52dea31e26d5e97bdc013759baa0515d3c7055c
2021-03-18Merge #21162: Net Processing: Move RelayTransaction() into PeerManagerfanquake
680eb56d828ce358b4e000c140f5b247ff5e6179 [net processing] Don't pass CConnman to RelayTransactions (John Newbery) a38a4e8f039dfabfd9435f3a63f1a9b56de086d6 [net processing] Move RelayTransaction into PeerManager (John Newbery) Pull request description: This is the first part of #21160. It moves the RelayTransaction() function to be a member function of the PeerManager class. This is required in order to move the transaction inventory data into the Peer object, since Peer objects are only accessible from within PeerManager. ACKs for top commit: ajtowns: ACK 680eb56d828ce358b4e000c140f5b247ff5e6179 Tree-SHA512: 8c93491a4392b6369bb7f090de326a63cd62a088de59026e202f226f64ded50a0cf1a95ed703328860f02a9d2f64d3a87ca1bca9a6075b978bd111d384766235
2021-03-17Merge #21415: refactor: remove Optional & nulloptWladimir J. van der Laan
ebc4ab721b0371c0ef217c0f5bd7d42613e951e6 refactor: post Optional<> removal cleanups (fanquake) 57e980d13ca488031bde6ef197cf34d493d36796 scripted-diff: remove Optional & nullopt (fanquake) Pull request description: Same rationale & motivation as #21404, which turned out to be quite low in the number of potential conflicts. Lets see what the bot has to say here. ACKs for top commit: practicalswift: cr ACK ebc4ab721b0371c0ef217c0f5bd7d42613e951e6: patch looks correct jnewbery: utACK ebc4ab721b0371c0ef217c0f5bd7d42613e951e6 laanwj: Code review ACK ebc4ab721b0371c0ef217c0f5bd7d42613e951e6 Tree-SHA512: 550fbeef09b9d35ddefaa805d1755c18c8fd499c4b0f77ebfece8c20296a7abd1cf6c699e2261f92fe3552deeb7555ec2a2287ffe3ab9e98bb9f8612a4d43be3
2021-03-17refactor: Pass PeerManagerImpl members only onceMarcoFalke
Can be reviewed with --word-diff-regex=. --ignore-all-space
2021-03-17refactor: post Optional<> removal cleanupsfanquake
2021-03-15scripted-diff: remove Optional & nulloptfanquake
-BEGIN VERIFY SCRIPT- git rm src/optional.h sed -i -e 's/Optional</std::optional</g' $(git grep -l 'Optional<' src) sed -i -e 's/{nullopt}/{std::nullopt}/g' $(git grep -l 'nullopt' src) sed -i -e 's/ nullopt;/ std::nullopt;/g' $(git grep -l 'nullopt' src) sed -i -e 's/ nullopt)/ std::nullopt)/g' $(git grep -l 'nullopt' src) sed -i -e 's/(nullopt)/(std::nullopt)/g' $(git grep -l 'nullopt' src) sed -i -e 's/ nullopt,/ std::nullopt,/g' $(git grep -l 'nullopt' src) sed -i -e 's/? nullopt :/? std::nullopt :/g' $(git grep -l 'nullopt' src) sed -i -e 's/: nullopt}/: std::nullopt}/g' $(git grep -l 'nullopt' src) sed -i -e '/optional.h \\/d' src/Makefile.am sed -i -e '/#include <optional.h>/d' src/test/fuzz/autofile.cpp src/test/fuzz/buffered_file.cpp src/test/fuzz/node_eviction.cpp sed -i -e 's/#include <optional.h>/#include <optional>/g' $(git grep -l '#include <optional.h>' src) -END VERIFY SCRIPT-
2021-03-12[net processing] Add ChainSyncTimeoutState default initializersJohn Newbery
Moves the default values closer to the member definitions.
2021-03-12[net processing] Remove CNodeState ctor bodyJohn Newbery
It's a no-op. The ctor for RollingBloomFilter already calls reset().
2021-03-12Merge #21394: [doc] Improve comment about protected peersfanquake
ebde946a527e50630df180c6565ea5bf8d2ab5aa [doc] Improve comment about protected peers (Amiti Uttarwar) Pull request description: The comment currently suggests a long-standing node would infrequently protect peers under normal circumstances. Clarify that we also protect peers that are synced to the same work as our chain tip. [Relevant check here](https://github.com/bitcoin/bitcoin/blob/ee0dc02c6f93de2a366bbff490eb4d37bca6a24f/src/net_processing.cpp#L1997). ACKs for top commit: Empact: ACK https://github.com/bitcoin/bitcoin/pull/21394/commits/ebde946a527e50630df180c6565ea5bf8d2ab5aa jnewbery: ACK ebde946a527e50630df180c6565ea5bf8d2ab5aa Tree-SHA512: 3692f4098e95f935d801e0ee6bbd3a7c9480e66ca070a7c68ba79c4fc2e62377f5d37080c7b6a7d15ab617aaf4d3df9b26abc4f1b090d572ba46fdd092a6a64a
2021-03-11Merge #21270: [Bundle 4/n] Prune g_chainman usage in validation-adjacent modulesWladimir J. van der Laan
a67983cd6d8e61565da4e03f3ba401d0148fe195 net_processing: Add review-only assertion to PeerManager (Carl Dong) 272d993e759e7fcfe883b84e9a2a3be3c75177ec scripted-diff: net_processing: Use existing chainman (Carl Dong) 021a04a46915468e7508a6ef44e7fbab1426343d net_processing: Move some static functions to PeerManager (Carl Dong) 91c5b68acd12cf7c2b4888d54d8fdd21837b2817 node/ifaces: ChainImpl: Use existing NodeContext member (Carl Dong) 8a1d580b2156268e3ab30f902b3fc9aa87bd2819 node/ifaces: NodeImpl: Use existing NodeContext member (Carl Dong) 4cde4a701b8856ac4ec9721b0226dbbfc52a71c3 node: Use existing NodeContext (Carl Dong) 106bcd4f390137904b5579cfef023fb8a5c8b4b5 node/coinstats: Pass in BlockManager to GetUTXOStats (Carl Dong) 2c3ba006930a5bbbf5a33bd530f3c1b2c4103c74 miner: Pass in blockman to ::RegenerateCommitments (Carl Dong) 2afcf24408b4453e4418ebfb326b141f6ea8647c miner: Remove old CreateNewBlock w/o chainstate param (Carl Dong) 46b7f29340acb399fbd2378508a204d8d8ee8fca scripted-diff: Invoke CreateNewBlock with chainstate (Carl Dong) d0de61b764fc7e9c670b69d8210705da296dd245 miner: Pass in chainstate to BlockAssembler::CreateNewBlock (Carl Dong) a04aac493fd564894166d58ed4cdfd9ad4f561cb validation: Remove extraneous LoadGenesisBlock function prototype (Carl Dong) Pull request description: Overall PR: #20158 (tree-wide: De-globalize ChainstateManager) Based on: - [x] #21055 | [Bundle 3/n] Prune g_chainman usage in mempool-related validation functions Note to reviewers: 1. This bundle may _apparently_ introduce usage of `g_chainman` or `::Chain(state|)Active()` globals, but these are resolved later on in the overall PR. [Commits of overall PR](https://github.com/bitcoin/bitcoin/pull/20158/commits) 2. There may be seemingly obvious local references to `ChainstateManager` or other validation objects which are not being used in callers of the current function in question, this is done intentionally to **_keep each commit centered around one function/method_** to ease review and to make the overall change systematic. We don't assume anything about our callers. Rest assured that once we are considering that particular caller in later commits, we will use the obvious local references. [Commits of overall PR](https://github.com/bitcoin/bitcoin/pull/20158/commits) 3. When changing a function/method that has many callers (e.g. `LookupBlockIndex` with 55 callers), it is sometimes easier (and less error-prone) to use a scripted-diff. When doing so, there will be 3 commits in sequence so that every commit compiles like so: 1. Add `new_function`, make `old_function` a wrapper of `new_function`, divert all calls to `old_function` to `new_function` **in the local module only** 2. Scripted-diff to divert all calls to `old_function` to `new_function` **in the rest of the codebase** 3. Remove `old_function` ACKs for top commit: laanwj: Code review ACK a67983cd6d8e61565da4e03f3ba401d0148fe195 ryanofsky: Code review ACK a67983cd6d8e61565da4e03f3ba401d0148fe195. Only change since last review new first commit fixing header declaration, and rebase glozow: code review ACK a67983cd6d8e61565da4e03f3ba401d0148fe195 Tree-SHA512: dce182a18b88be80cbf50978d4ba8fa6ab0f01e861d09bae0ae9364051bb78f9334859d164b185b07f1d70a583e739557fab6d820cac8c37b3855b85c2a6771b
2021-03-09[net processing] Remove unused CNode.address memberJohn Newbery
2021-03-08[doc] Improve comment about protected peersAmiti Uttarwar
The comment currently suggests a long-standing node would infrequently protect peers under normal circumstances. Clarify that we also protect peers that are synced to the same work as our chain tip.
2021-03-08net_processing: Add review-only assertion to PeerManagerCarl Dong
2021-03-08scripted-diff: net_processing: Use existing chainmanCarl Dong
-BEGIN VERIFY SCRIPT- sed -i -E \ -e 's/g_chainman/m_chainman/g' \ -e 's@([^:])(Chain(state|)Active)@\1::\2@g' \ -e 's@::Chain(state|)Active\(\)@m_chainman.ActiveChain\1()@g' \ -- src/net_processing.cpp -END VERIFY SCRIPT-
2021-03-08net_processing: Move some static functions to PeerManagerCarl Dong
- BlockRequestAllowed - AlreadyHaveBlock - ProcessGetBlockData - PrepareBlockFilterRequest - ProcessGetCFilters - ProcessGetCFHeaders - ProcessGetCFCheckPt Moved out of anonymous namespace: - ProcessBlockAvailability - UpdateBlockAvailability - CanDirectFetch