aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
AgeCommit message (Collapse)Author
2021-07-15Add logging and addr rate limiting statisticsPieter Wuille
Includes logging improvements by Vasil Dimov and John Newbery.
2021-07-15Randomize the order of addr processingPieter Wuille
2021-07-15Rate limit the processing of incoming addr messagesPieter Wuille
While limitations on the influence of attackers on addrman already exist (affected buckets are restricted to a subset based on incoming IP / network group), there is no reason to permit them to let them feed us addresses at more than a multiple of the normal network rate. This commit introduces a "token bucket" rate limiter for the processing of addresses in incoming ADDR and ADDRV2 messages. Every connection gets an associated token bucket. Processing an address in an ADDR or ADDRV2 message from non-whitelisted peers consumes a token from the bucket. If the bucket is empty, the address is ignored (it is not forwarded or processed). The token counter increases at a rate of 0.1 tokens per second, and will accrue up to a maximum of 1000 tokens (the maximum we accept in a single ADDR or ADDRV2). When a GETADDR is sent to a peer, it immediately gets 1000 additional tokens, as we actively desire many addresses from such peers (this may temporarily cause the token count to exceed 1000). The rate limit of 0.1 addr/s was chosen based on observation of honest nodes on the network. Activity in general from most nodes is either 0, or up to a maximum around 0.025 addr/s for recent Bitcoin Core nodes. A few (self-identified, through subver) crawler nodes occasionally exceed 0.1 addr/s.
2021-06-29[refactor] Add deploymentstatus.hAnthony Towns
Provides DeploymentEnabled, DeploymentActiveAt, and DeploymentActiveAfter helpers for checking the status of buried deployments. Can be overloaded so the same syntax works for non-buried deployments, allowing future soft forks to be changed from signalled to buried deployments without having to touch the implementation code. Replaces IsWitnessEnabled and IsScriptWitnessEnabled.
2021-06-29Merge bitcoin/bitcoin#21789: refactor: Remove ::Params() global from CChainStatefanquake
fa0d9211ef87a682573aaae932c0c440acbcb8a8 refactor: Remove chainparams arg from CChainState member functions (MarcoFalke) fa389471251f043ec25e7b01e59b37d3b921ce54 refactor: Remove ::Params() global from inside CChainState member functions (MarcoFalke) Pull request description: The `::Params()` global is verbose and confusing. Also it makes tests a bit harder to write because they'd have to mock a global. Fix all issues by simply using a member variable that points to the right params. (Can be reviewed with `--word-diff-regex=.`) ACKs for top commit: jnewbery: ACK fa0d9211ef87a682573aaae932c0c440acbcb8a8 kiminuo: utACK fa0d9211 theStack: ACK fa0d9211ef87a682573aaae932c0c440acbcb8a8 🍉 Tree-SHA512: 44676b19c9ed471ccb536331d3029bad192d7d50f394fd7b8527ec431452aeec8c4494164b9cf8e16e0123c4463b16be864366c6b599370032c17262625a0356
2021-06-23script, doc: spelling updateJon Atack
2021-06-21Merge bitcoin/bitcoin#22147: p2p: Protect last outbound HB compact block peerW. J. van der Laan
30aee2dfe671b347438c1c327c6f79edfacff1ce tests: Add test for compact block HB selection (Pieter Wuille) 6efbcec4ded6116a42d2783c96c60ef0f255a1b2 Protect last outbound HB compact block peer (Suhas Daftuar) Pull request description: If all our high-bandwidth compact block serving peers (BIP 152) stall block download, then we can be denied a block for (potentially) a long time. As inbound connections are much more likely to be adversarial than outbound connections, mitigate this risk by never removing our last outbound HB peer if it would be replaced by an inbound. ACKs for top commit: achow101: ACK 30aee2dfe671b347438c1c327c6f79edfacff1ce ariard: Code ACK 30aee2dfe jonatack: ACK 30aee2dfe671b347438c1c327c6f79edfacff1ce Tree-SHA512: 5c6c9326e3667b97e0864c371ae2174d2be9054dad479f4366127b9cd3ac60ffa01ec9707b16ef29cac122db6916cf56fd9985733390017134ace483278921d5
2021-06-13refactor: Remove chainparams arg from CChainState member functionsMarcoFalke
Passing this is confusing and redundant with the m_params member.
2021-06-12Merge bitcoin/bitcoin#22221: refactor: Pass block reference instead of ↵fanquake
pointer to PeerManagerImpl::BlockRequested fa334b405411dc97fbed12b5e9103510eeb2c9f1 refactor: Pass block reference instead of pointer to PeerManagerImpl::BlockRequested (MarcoFalke) Pull request description: This allows to remove an assert and at the same time make it more obvious that the block is never nullptr. Also, add missing `{}` while touching the function. ACKs for top commit: jnewbery: Code review ACK fa334b405411dc97fbed12b5e9103510eeb2c9f1 mjdietzx: crACK fa334b405411dc97fbed12b5e9103510eeb2c9f1 theStack: Code review ACK fa334b405411dc97fbed12b5e9103510eeb2c9f1 Tree-SHA512: 9733d3e20e048fcb2ac7510eae3539ce8aaa7397bd944a265123f1ffd90e15637cdaad19dba16f76d83f3f0d1888f1b7014c191bb430e410a106c49ca61a725c
2021-06-11refactor: Pass block reference instead of pointer to ↵MarcoFalke
PeerManagerImpl::BlockRequested
2021-06-10scripted-diff: tree-wide: Remove all review-only assertionsCarl Dong
-BEGIN VERIFY SCRIPT- find_regex='((assert|CHECK_NONFATAL)\(std::addressof|TODO: REVIEW-ONLY)' \ && git grep -l -E "$find_regex" -- . \ | xargs sed -i -E "/${find_regex}/d" -END VERIFY SCRIPT-
2021-06-03Protect last outbound HB compact block peerSuhas Daftuar
If all our high-bandwidth compact block serving peers (BIP 152) stall block download, then we can be denied a block for (potentially) a long time. As inbound connections are much more likely to be adversarial than outbound connections, mitigate this risk by never removing our last outbound HB peer if it would be replaced by an inbound.
2021-06-03scripted-diff: rename MarkBlockAs functionsJohn Newbery
-BEGIN VERIFY SCRIPT- ren() { sed -i "s:\<$1\>:$2:g" $(git grep -l "\<$1\>" ./src ./test); } ren MarkBlockAsInFlight BlockRequested ren MarkBlockAsReceived RemoveBlockRequest -END VERIFY SCRIPT-
2021-06-03[net processing] Tidy up MarkBlockAsReceived()John Newbery
2021-06-03[net processing] Add IsBlockRequested() functionJohn Newbery
MarkBlockAsReceived() should not be used for both removing the block from mapBlocksInFlight and checking whether it was in the map.
2021-06-03[net processing] Remove QueuedBlock.hashJohn Newbery
It's redundant with CBlockIndex::GetBlockHash()
2021-06-03scripted-diff: rename nPeersWithValidatedDownloadsJohn Newbery
-BEGIN VERIFY SCRIPT- ren() { sed -i "s:\<$1\>:$2:g" $(git grep -l "\<$1\>" ./src ./test); } ren nPeersWithValidatedDownloads m_peers_downloading_from -END VERIFY SCRIPT-
2021-06-03[net processing] Remove CNodeState.nBlocksInFlightValidHeadersJohn Newbery
nBlocksInFlightValidHeaders always has the same value as nBlocksInFlight, since we only download blocks with valid headers.
2021-06-03[net processing] Remove QueuedBlock.fValidatedHeadersJohn Newbery
Since headers-first syncing, we only ever request a block if we've already validated its headers. Therefore QueuedBlock.fValidatedHeaders is always set to true. Remove it.
2021-06-03[net processing] Remove unnecessary hash arg from MarkBlockAsInFlight()John Newbery
MarkBlockAsInFlight is always called with a non-null pindex. Just get the block hash from that pindex inside the function.
2021-05-31net: cleanup newly added PeerManagerImpl::ProcessNewBlockfanquake
Addresses some post-merge comments.
2021-05-25Merge bitcoin/bitcoin#21992: p2p: Remove -feefilter optionMarcoFalke
a7a43e8fe85f6247c35d7ff99f36448574f3e34a Factor feefilter logic out (amadeuszpawlik) c0385f10a133d5d8a4c296e7b7a6d75c9c4eec12 Remove -feefilter option (amadeuszpawlik) Pull request description: net: Remove -feefilter option, as it is debug only and isn't used in any tests. Checking this option for every peer on every iteration of the message handler is unnecessary, as described in #21545. refactor: Move feefilter logic out into a separate `MaybeSendFeefilter(...)` function to improve readability of the already long `SendMessages(...)`. fixes #21545 The configuration option `-feefilter` has been added in 9e072a6e66efbda7d39bf61eded21d2b324323be: _"Implement "feefilter" P2P message"_ According to the [BIP133](https://github.com/bitcoin/bips/blob/master/bip-0133.mediawiki), turning the fee filter off was ment for: > [...] a node [...] using prioritisetransaction to accept transactions whose actual fee rates might fall below the node's mempool min fee [in order to] disable the fee filter to make sure it is exposed to all possible txid's `-feefilter` was subsequently set as debug only in #8150, with the motivation that the help message was too difficult to translate. ACKs for top commit: jnewbery: Code review ACK a7a43e8fe85f6247c35d7ff99f36448574f3e34a promag: Code review ACK a7a43e8fe85f6247c35d7ff99f36448574f3e34a. MarcoFalke: review ACK a7a43e8fe85f6247c35d7ff99f36448574f3e34a 🦁 Tree-SHA512: 8ef9a2f255597c0279d3047dcc968fd30fb7402e981b69206d08eed452c705ed568c24e646e98d06eac118eddd09205b584f45611d1c874abf38f48b08b67630
2021-05-24Factor feefilter logic outamadeuszpawlik
Break SendMessages() function into smaller units to improve readability. Adds lock assert, as `round()` isn't thread safe. closes #21545
2021-05-24Merge bitcoin/bitcoin#21186: net/net processing: Move addr data into ↵fanquake
net_processing 0829516d1f3868c1c2ba507feee718325d81e329 [refactor] Remove unused ForEachNodeThen() template (John Newbery) 09cc66c00e1d5fabe11ffcc32cad060e6b483b20 scripted-diff: rename address relay fields (John Newbery) 76568a3351418c878d30ba0373cf76988f93f90e [net processing] Move addr relay data and logic into net processing (John Newbery) caba7ae8a505a4b4680a9d7618f65c4e8579a1e2 [net processing] Make RelayAddress() a member function of PeerManagerImpl (John Newbery) 86acc9646968213aaa4408635915b1bfd75a10c9 [net processing] Take NodeId instead of CNode* as originator for RelayAddress() (John Newbery) Pull request description: This continues the work of moving application layer data into net_processing, by moving all addr data into the new Peer object added in #19607. For motivation, see #19398. ACKs for top commit: laanwj: Code review ACK 0829516d1f3868c1c2ba507feee718325d81e329 mzumsande: ACK 0829516d1f3868c1c2ba507feee718325d81e329, reviewed the code and ran tests. sipa: utACK 0829516d1f3868c1c2ba507feee718325d81e329 hebasto: re-ACK 0829516d1f3868c1c2ba507feee718325d81e329 Tree-SHA512: efe0410fac288637f203eb37d1999910791e345872d37e1bd5cde50e25bb3cb1c369ab86b3a166ffd5e06ee72e4508aa2c46d658be6a54e20b4f220d2f57d0a6
2021-05-19Remove -feefilter optionamadeuszpawlik
Feefilter option is debug only and it isn't used in any tests, it's wasteful to check this option for every peer on every iteration of the message handler loop. refs #21545
2021-05-19p2p: allow CConnman::GetAddresses() by network, add doxygenJon Atack
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-30scripted-diff: rename address relay fieldsJohn Newbery
-BEGIN VERIFY SCRIPT- ren() { sed -i "s:\<$1\>:$2:g" $(git grep -l "\<$1\>" ./src ./test); } ren fGetAddr m_getaddr_sent ren fSentAddr m_getaddr_recvd ren vAddrToSend m_addrs_to_send -END VERIFY SCRIPT-
2021-04-30[net processing] Move addr relay data and logic into net processingJohn Newbery
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-01[net processing] Make RelayAddress() a member function of PeerManagerImplJohn Newbery
2021-04-01[net processing] Take NodeId instead of CNode* as originator for RelayAddress()John Newbery
This makes the following commit easier.
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