aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
AgeCommit message (Collapse)Author
2021-02-22Merge #20845: net: Log to net debug in MaybeDiscourageAndDisconnect except ↵MarcoFalke
for noban and manual peers fa55159b9ede4a915f8ef9e5b90e3e99eadedf91 net: Log to net debug in MaybeDiscourageAndDisconnect except for noban and manual peers (MarcoFalke) Pull request description: The goal is to avoid local peers (e.g. untrusted peers on the local network or inbound onion peers via a local onion proxy) filling the debug log (and thus the disk). ACKs for top commit: practicalswift: ACK fa55159b9ede4a915f8ef9e5b90e3e99eadedf91 vasild: ACK fa55159b9ede4a915f8ef9e5b90e3e99eadedf91 Tree-SHA512: de233bf57334580f9b91f369fafd131d71c5ae25db25b09cc8fa8cbf34c0648f083c52260a6a912238751467e3c3c5f5d2309c145710753058d44a0003f88f4f
2021-02-20Merge #20750: [Bundle 2/n] Prune g_chainman usage in mempool-related ↵MarcoFalke
validation functions e8ae1db864b09a47c736631e6cd3f5ec17929850 style-only: Make AcceptToMemoryPool signature readable (Carl Dong) 8f5c100064bea720351d450f8116ff3abe0515cc style-only: Make CheckSequenceLock signature readable (Carl Dong) 8c824819c85005ee6c783e9f8fa43ff91716e33d validation: Use *this in CChainState::LoadMempool (Carl Dong) 0a9a24d8c717e88e36e16014630cec8eada8dfcb validation: Pass in chainstate to UpdateMempoolForReorg (Carl Dong) 714201881251a787423fbca34f70fed505e9dc28 validation: Pass in chainstate to CTxMemPool::removeForReorg (Carl Dong) 71734c65dc491a4bb654ccbb7a1dd0e12131cee4 validation: Pass in chain to ::TestLockPointValidity (Carl Dong) 120aaba9ac41af71a760aa0969dd090e96786fb3 tree-wide: Fix erroneous AcceptToMemoryPool replacements (Carl Dong) 417dafc1ee07af3319c2fe89758123cb8362ff16 validation: Remove old AcceptToMemoryPool w/o chainstate param (Carl Dong) 3704433c4f5ecf9f196860b2ccecae0d2c8b5f6e scripted-diff: Invoke ::AcceptToMemoryPool with chainstate (Carl Dong) 229bc37b5f18cffbc85efbad3b6e9047c6951e95 validation: Pass in chainstate to ::AcceptToMemoryPool (Carl Dong) d0da7ea57ab932eca956458fb3633585ff3c0003 validation: Pass in chainstate to ::LoadMempool (Carl Dong) 3a205c43dc03cc833daba93087279402f640965b validation: Pass in chainstate to AcceptToMemoryPoolWithTime (Carl Dong) d8a816329c878b5973d28d370c0f64ebbdde716b validation: Add chainstate member to MemPoolAccept (Carl Dong) 4c15942b79c46256950df17c348302679e668ebc validation: Pass in chainstate to ::CheckSequenceLocks (Carl Dong) 577b774d0c664b891bc9e1550ef179a655a466ad validation: Remove old CheckFinalTx w/o chain tip param (Carl Dong) 7031cf89db943d3e73597d2f9fa4a41908558e6c scripted-diff: Invoke ::CheckFinalTx with chain tip (Carl Dong) d015eaa550027a387cd548cf0bcfa1a4c31a3374 validation: Pass in chain tip to ::CheckFinalTx (Carl Dong) 252b489c9f9c9e7dceb919e9cbd208ea72d75e68 validation: Pass in coins tip to CheckInputsFromMempoolAndCache (Carl Dong) 73a6d2b7bea832fe24870dd7593c8fc1028e8d57 validation: Pass in chainstate to IsCurrentForFeeEstimation (Carl Dong) d1f932b0b0685690e5142272a2ed6a21237fbf05 validation: Pass in coins cache to ::LimitMempoolSize (Carl Dong) Pull request description: Overall PR: #20158 (tree-wide: De-globalize ChainstateManager) 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: glozow: reACK https://github.com/bitcoin/bitcoin/commit/e8ae1db864b09a47c736631e6cd3f5ec17929850 via `git range-diff 15f0042...e8ae1db`, only change is fixing ATMP call from conflict MarcoFalke: ACK e8ae1db864b09a47c736631e6cd3f5ec17929850 📣 Tree-SHA512: 6af50f04940a69c5c3d3796a24f32f963fa02503cdc1155cc11fff832a99172b407cd163a19793080a5af98580f051b48195b62ec4a797ba2763b4883174153d
2021-02-19Merge #21187: Net processing: Only call PushAddress() from net_processingMarcoFalke
3e68efa615968e0c9d68a7f197c7852478f6be78 [net] Move checks from GetLocalAddrForPeer to caller (John Newbery) d21d2b264cd77c027a06f68289cf4c3f177d1ed0 [net] Change AdvertiseLocal to GetLocalAddrForPeer (John Newbery) Pull request description: This is the first part of #21186. It slightly disentangles addr handling in net/net_processing by making it explicit that net_processing is responsible for pushing addr records into `vAddrToSend`. ACKs for top commit: MarcoFalke: re-ACK 3e68efa615968e0c9d68a7f197c7852478f6be78 🍅 Tree-SHA512: 9af50c41f5a977e2e277f24a589db38e2980b353401def5e74b108ac5f493d9b5d6b1b8bf15323a4d66321495f04bc271450fcef7aa7d1c095f051a4f8e9b15f
2021-02-18scripted-diff: Invoke ::AcceptToMemoryPool with chainstateCarl Dong
-BEGIN VERIFY SCRIPT- find_regex='\bAcceptToMemoryPool\(' \ && git grep -l -E "$find_regex" -- src \ | grep -v '^src/validation\.\(cpp\|h\)$' \ | xargs sed -i -E 's@'"$find_regex"'@\0::ChainstateActive(), @g' -END VERIFY SCRIPT-
2021-02-18[net] Move checks from GetLocalAddrForPeer to callerJohn Newbery
GetLocalAddrForPeer() is only called in one place. The checks inside that function make more sense to be carried out be the caller: - fSuccessfullyConnected is already checked at the top of SendMessages(), so must be true when we call GetLocalAddrForPeer() - fListen can go into the conditional before GetLocalAddrForPeer() is called.
2021-02-18[net] Change AdvertiseLocal to GetLocalAddrForPeerJohn Newbery
Gossiping addresses to peers is the responsibility of net processing. Change AdvertiseLocal() in net to just return an (optional) address for net processing to advertise. Update function name to reflect new responsibility.
2021-02-17Merge #21188: scripted-diff: Remove redundant lock annotations in net processingMarcoFalke
fafddfadda0c77876ba764c5b65ee5fa8e53a5e0 scripted-diff: Remove shadowing lock annotations (MarcoFalke) Pull request description: Would be good to not redundantly copy the lock annotation from the class declaration to the member implementation. Otherwise it may not result in a compile failure if a new lock requirement is added to the member implementation, but not the class declaration. ACKs for top commit: amitiuttarwar: ACK `fafddfadda`, confirmed that the annotations removed were all redundant. confirmed the claim of potential issue :) hebasto: ACK fafddfadda0c77876ba764c5b65ee5fa8e53a5e0 jonatack: Light utACK fafddfadda0c77876ba764c5b65ee5fa8e53a5e0 verified that the removed annotations in the definitions correspond to those in their respective declarations Tree-SHA512: ea095c6d4e0bedd70d4e2d8a42b06cfd90c161ebfcaac13558c5dc065601a732e5f812f332104b7daa087aa57b8b0242b177799d22eef7628d77d4d87f443bf2
2021-02-16net: Log to net debug in MaybeDiscourageAndDisconnect except for noban and ↵MarcoFalke
manual peers
2021-02-15scripted-diff: rename ping membersJohn Newbery
-BEGIN VERIFY SCRIPT- sed -i 's/fPingQueued/m_ping_queued/g' src/net_processing.cpp sed -i 's/nMinPingUsecTime/m_min_ping_time/g' src/net.* src/net_processing.cpp src/test/net_tests.cpp sed -i 's/nPingNonceSent/m_ping_nonce_sent/g' src/net_processing.cpp sed -i 's/nPingUsecTime/m_last_ping_time/g' src/net.* -END VERIFY SCRIPT-
2021-02-15[net processing] Move ping data fields to net processingJohn Newbery
2021-02-15[net processing] Move ping timeout logic to net processingJohn Newbery
Ping messages are an application-level mechanism. Move timeout logic from net to net processing.
2021-02-15[net processing] Move send ping message logic into functionJohn Newbery
2021-02-15[net processing] Add Peer& arg to MaybeDiscourageAndDisconnect()John Newbery
Refactor only. No change in behaviour.
2021-02-15scripted-diff: Remove shadowing lock annotationsMarcoFalke
Can be reviewed with --word-diff-regex=. -BEGIN VERIFY SCRIPT- sed -i --regexp-extended 's/(PeerManagerImpl::.*\)).*LOCKS_.*\)/\1/g' ./src/net_processing.cpp -END VERIFY SCRIPT-
2021-02-15Merge #20942: [refactor] Move some net_processing globals into PeerManagerImplMarcoFalke
6452190841f8da1cdaf899d064974136ab37659f net_processing: simplify MaybeSetPeerAsAnnouncingHeaderAndIDs args (Anthony Towns) 39c2a69bc28eb3e3b5fa15a3965773b459bbf7ad net_processing: move MaybeSetPeerAsAnnouncingHeadersAndIDs into PeerManagerImpl (Anthony Towns) 7b7117efd00acf7609e65d3b4fe5f76e400dda12 net_processing: simplify ProcessGetData and FindTxForGetData args (Anthony Towns) 34207b9004d2069a8fcb32758cd796143eccfb4d net_processing: move FindTxForGetData and ProcessGetData to PeerManagerImpl (Anthony Towns) d44084883adcf00f50d3d5a9e0c88e3a0b276817 net_processing: simplify PeerManageImpl method args (Anthony Towns) a490f0a056456d683dd8ef6f89a5af1a13792118 net_processing: move MarkBlockAs*, TipMayBeStale, FindNextBlocksToDL to PeerManagerImpl (Anthony Towns) 052d9bc7e52aea373a316f08d42460ead4ed16c8 net_processing: simplify AlreadyHaveTx args (Anthony Towns) eeac5062508c98fe58daaec471cdd27f3909b6ec net_processing: move AlreadyHaveTx into PeerManageImpl (Anthony Towns) 9781c08a33569370f191b30cc7e2ce9b5317eb3e net_processing: move some globals into PeerManagerImpl (Anthony Towns) Pull request description: Turns some globals into member variables, and simplifies the parameter list for some of net_processing's internal functions. Mostly just serves as a code cleanup at this point. ACKs for top commit: jnewbery: Code review ACK 6452190841f8da1cdaf899d064974136ab37659f ariard: Code Review ACK 6452190, changes are pretty straightforward. MarcoFalke: Concept ACK 6452190841 I have not reviewed this, but I left a comment 🐡 Tree-SHA512: 381361f9dbfeb851a5522ead3165ce1447a0f212ddea4b483aa38975559ee5ed03a4ba69c24fd69f36847a1eddfef05785f5cbb2fcec5fe50f8b336e8047c3b1
2021-02-11Merge #21062: refactor: return MempoolAcceptResult from ATMPMarcoFalke
53e716ea119658c28935fee24eb50090907c500e [refactor] improve style for touched code (gzhao408) 174cb5330af4b09f3a66974d3bae783ea43b190e [refactor] const ATMPArgs and non-const Workspace (gzhao408) f82baf0762f60c2ca5ffc339b095f9271d7c2f33 [refactor] return MempoolAcceptResult (gzhao408) 9db10a55061e09021ff8ea1d6637d99f7959035f [refactor] clean up logic in testmempoolaccept (gzhao408) Pull request description: This is the first 4 commits of #20833, and does refactoring only. It should be relatively simple to review, and offers a few nice things: - It makes accessing values that don't make sense (e.g. fee) when the tx is invalid an error. - Returning `MempoolAcceptResult` from ATMP makes the interface cleaner. The caller can get a const instead of passing in a mutable "out" param. - We don't have to be iterating through a bunch of lists for package validation, we can just return a `std::vector<MempoolAcceptResult>`. - We don't have to refactor all ATMP call sites again if/when we want to return more stuff from it. ACKs for top commit: MarcoFalke: ACK 53e716ea119658c28935fee24eb50090907c500e 💿 jnewbery: Code review ACK 53e716ea119658c28935fee24eb50090907c500e ariard: Code Review ACK 53e716e, I did tweak a bit the touched paths to see if we had good test coverage. Didn't find holes. Tree-SHA512: fa6ec324a08ad9e6e55948615cda324cba176255708bf0a0a0f37cedb7a75311aa334ac6f223be7d8df3c7379502b1081102b9589f9a9afa1713ad3d9ab3c24f
2021-02-11Merge #21043: net: Avoid UBSan warning in ProcessMessage(...)MarcoFalke
3ddbf22ed179a2db733af4b521bec5d2b13ebf4b util: Disallow negative mocktime (MarcoFalke) f5f2f9716885e7548809e77f46b493c896a019bf net: Avoid UBSan warning in ProcessMessage(...) (practicalswift) Pull request description: Avoid UBSan warning in `ProcessMessage(...)`. Context: https://github.com/bitcoin/bitcoin/pull/20380#issuecomment-770427182 (thanks Crypt-iQ!) ACKs for top commit: MarcoFalke: re-ACK 3ddbf22ed179a2db733af4b521bec5d2b13ebf4b only change is adding patch written by me ajtowns: ACK 3ddbf22ed179a2db733af4b521bec5d2b13ebf4b -- code review only Tree-SHA512: e8d7af0457ca86872b75a4e406c0a93aafd841c2962e244e147e748cc7ca118c56be0fdafe53765f4b291410030b2c3cc8f76f733b37a955d34fc885ab6037b9
2021-02-09[refactor] return MempoolAcceptResultgzhao408
This creates a cleaner interface with ATMP, allows us to make results const, and makes accessing values that don't make sense (e.g. fee when tx is invalid) an error.
2021-02-02doc: refer to BIPs 339/155 in feature negotiationJon Atack
and add fSuccessfullyConnected doxygen documentation to clarify that it is set to true on VERACK
2021-02-02Merge #19509: Per-Peer Message CaptureMarcoFalke
bff7c66e67aa2f18ef70139338643656a54444fe Add documentation to contrib folder (Troy Giorshev) 381f77be858d7417209b6de0b7cd23cb7eb99261 Add Message Capture Test (Troy Giorshev) e4f378a505922c0f544b4cfbfdb169e884e02be9 Add capture parser (Troy Giorshev) 4d1a582549bc982d55e24585b0ba06f92f21e9da Call CaptureMessage at appropriate locations (Troy Giorshev) f2a77ff97bec09dd5fcc043d8659d8ec5dfb87c2 Add CaptureMessage (Troy Giorshev) dbf779d5deb04f55c6e8493ce4e12ed4628638f3 Clean PushMessage and ProcessMessages (Troy Giorshev) Pull request description: This PR introduces per-peer message capture into Bitcoin Core. 📓 ## Purpose The purpose and scope of this feature is intentionally limited. It answers a question anyone new to Bitcoin's P2P protocol has had: "Can I see what messages my node is sending and receiving?". ## Functionality When a new debug-only command line argument `capturemessages` is set, any message that the node receives or sends is captured. The capture occurs in the MessageHandler thread. When receiving a message, it is captured as soon as the MessageHandler thread takes the message off of the vProcessMsg queue. When sending, the message is captured just before the message is pushed onto the vSendMsg queue. The message capture is as minimal as possible to reduce the performance impact on the node. Messages are captured to a new `message_capture` folder in the datadir. Each node has their own subfolder named with their IP address and port. Inside, received and sent messages are captured into two binary files, msgs_recv.dat and msgs_sent.dat, like so: ``` message_capture/203.0.113.7:56072/msgs_recv.dat message_capture/203.0.113.7:56072/msgs_sent.dat ``` Because the messages are raw binary dumps, included in this PR is a Python parsing tool to convert the binary files into human-readable JSON. This script has been placed on its own and out of the way in the new `contrib/message-capture` folder. Its usage is simple and easily discovered by the autogenerated `-h` option. ## Future Maintenance I sympathize greatly with anyone who says "the best code is no code". The future maintenance of this feature will be minimal. The logic to deserialize the payload of the p2p messages exists in our testing framework. As long as our testing framework works, so will this tool. Additionally, I hope that the simplicity of this tool will mean that it gets used frequently, so that problems will be discovered and solved when they are small. ## FAQ "Why not just use Wireshark" Yes, Wireshark has the ability to filter and decode Bitcoin messages. However, the purpose of the message capture added in this PR is to assist with debugging, primarily for new developers looking to improve their knowledge of the Bitcoin Protocol. This drives the design in a different direction than Wireshark, in two different ways. First, this tool must be convenient and simple to use. Using an external tool, like Wireshark, requires setup and interpretation of the results. To a new user who doesn't necessarily know what to expect, this is unnecessary difficulty. This tool, on the other hand, "just works". Turn on the command line flag, run your node, run the script, read the JSON. Second, because this tool is being used for debugging, we want it to be as close to the true behavior of the node as possible. A lot can happen in the SocketHandler thread that would be missed by Wireshark. Additionally, if we are to use Wireshark, we are at the mercy of whoever it maintaining the protocol in Wireshark, both as to it being accurate and recent. As can be seen by the **many** previous attempts to include Bitcoin in Wireshark (google "bitcoin dissector") this is easier said than done. Lastly, I truly believe that this tool will be used significantly more by being included in the codebase. It's just that much more discoverable. ACKs for top commit: MarcoFalke: re-ACK bff7c66e67aa2f18ef70139338643656a54444fe only some minor changes: 👚 jnewbery: utACK bff7c66e67aa2f18ef70139338643656a54444fe theStack: re-ACK bff7c66e67aa2f18ef70139338643656a54444fe Tree-SHA512: e59e3160422269221f70f98720b47842775781c247c064071d546c24fa7a35a0e5534e8baa4b4591a750d7eb16de6b4ecf54cbee6d193b261f4f104e28c15f47
2021-02-02net: Avoid UBSan warning in ProcessMessage(...)practicalswift
2021-02-01Merge #20749: [Bundle 1/n] Prune g_chainman usage related to ::LookupBlockIndexWladimir J. van der Laan
67c9a83df19c6e2a2edb32336879204e7770b4a7 style-only: Remove redundant sentence in ActivateBestChain comment (Carl Dong) b8e95658d5909f93dfc7d1e6532661db8919e5b7 style-only: Make TestBlockValidity signature readable (Carl Dong) 0cdad753903640ff4240b715dec9d62f68e51407 validation: Use accessible chainstate in ChainstateManager::ProcessNewBlock (Carl Dong) ea4fed90219be17160136313c68c06d84176af08 validation: Use existing chainstate in ChainstateManager::ProcessNewBlockHeaders (Carl Dong) e0dc3057277c9576ddbfb8541599db0149e08bb6 validation: Move LoadExternalBlockFile to CChainState (Carl Dong) 5f8cd7b3a527999512161956db4d718688cb956f validation: Remove global ::ActivateBestChain (Carl Dong) 2a696472a1423e877bfa83f016f66c7e45be7369 validation: Pass in chainstate to ::NotifyHeaderTip (Carl Dong) 9c300cc8b3ce3d82874982fbf3087e48a6ac0ef2 validation: Pass in chainstate to TestBlockValidity (Carl Dong) 0e17c833cda67cdba5338bd7409061772b6d5edb validation: Make CChainState.m_blockman public (Carl Dong) d363d06bf7d6c3736140672ba8a7f82f4d6fb6ab validation: Pass in blockman to ContextualCheckBlockHeader (Carl Dong) f11d11600ddb0ddff6538250ae2a35df6112c3db validation: Move GetLastCheckpoint to BlockManager (Carl Dong) e4b95eefbc700ebc915bec312f77477ce3e87a7e validation: Move GetSpendHeight to BlockManager (Carl Dong) b026e318c39f59a06e29f1b25c7f577e01b25ccb validation: Move FindForkInGlobalIndex to BlockManager (Carl Dong) 3664a150ac7547c9336b571557af223d9e31aac9 validation: Remove global LookupBlockIndex (Carl Dong) eae54e6e60d7ed05b29d8345c0bb055397149ce8 scripted-diff: Use BlockManager::LookupBlockIndex (Carl Dong) 15d20f40e1321b24963b40c12958c7d30ad112ec validation: Move LookupBlockIndex to BlockManager (Carl Dong) f92dc6557a153b390a1ae1d0808ff7ed5d02c66e validation: Guard the active_chainstate with cs_main (Carl Dong) Pull request description: Overall PR: #20158 (tree-wide: De-globalize ChainstateManager) 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: jnewbery: utACK 67c9a83df19c6e2a2edb32336879204e7770b4a7 laanwj: re-ACK 67c9a83df19c6e2a2edb32336879204e7770b4a7 ryanofsky: Code review ACK 67c9a83df19c6e2a2edb32336879204e7770b4a7. Changes since last review: Tree-SHA512: 8744aba2dd57a40cd2fedca809b0fe24d771bc60da1bffde89601999384aa0df428057a86644a3f72fbeedbc8b04db6c4fd264ea0db2e73c279e5acc6d056cbf
2021-01-30net_processing: simplify MaybeSetPeerAsAnnouncingHeaderAndIDs argsAnthony Towns
No need to pass connman to PeerManagerImpl methods.
2021-01-30net_processing: move MaybeSetPeerAsAnnouncingHeadersAndIDs into PeerManagerImplAnthony Towns
Allows making lNodesAnnouncingHeaderAndIDs and nPeersWithValidatedDownloads member vars instead of globals.
2021-01-30net_processing: simplify ProcessGetData and FindTxForGetData argsAnthony Towns
No need to pass mempool or connman to PeerManagerImpl methods.
2021-01-30net_processing: move FindTxForGetData and ProcessGetData to PeerManagerImplAnthony Towns
Allows making mapRelay and vRelayExpiration members rather than globals.
2021-01-30net_processing: simplify PeerManageImpl method argsAnthony Towns
No need to pass mempool to MarkBlockAsInFlight, or consensusParams to TipMayBeStale or FindNextBlocksToDownload.
2021-01-30net_processing: move MarkBlockAs*, TipMayBeStale, FindNextBlocksToDL to ↵Anthony Towns
PeerManagerImpl Allows converting mapBlocksInFlight and g_last_tip_update from globals to member variables.
2021-01-30net_processing: simplify AlreadyHaveTx argsAnthony Towns
No need to pass mempool to PeerManagerImpl methods.
2021-01-30net_processing: move AlreadyHaveTx into PeerManageImplAnthony Towns
Allows making recentRejects and g_recent_confirmed_transactions members rather than globals.
2021-01-30net_processing: move some globals into PeerManagerImplAnthony Towns
nSyncStarted, mapBlockSource, g_wtxid_relay_peers, g_outbound_peers_with_protect_from_disconnect were all only used by PeerManagerImpl methods already.
2021-01-28validation: Remove global ::ActivateBestChainCarl Dong
Instead use CChainState::ActivateBestChain, which is what the global one calls anyway.
2021-01-28validation: Move FindForkInGlobalIndex to BlockManagerCarl Dong
[META] This commit should be followed up by removing the comments and assertions meant only to show that the change is correct. FindForkInGlobalIndex only acts on BlockManager. Note to reviewers: Since FindForkInGlobalIndex is always called with ::ChainActive() as its first parameter, it is possible to move FindForkInGlobalIndex to CChainState and remove this const CChain& parameter to instead use m_chain. However, it seems like the original intention was for FindForkInGlobalIndex to work with _any_ chain, not just the current active chain. Let me know if this should be changed.
2021-01-28scripted-diff: Use BlockManager::LookupBlockIndexCarl Dong
[META] In a previous commit, we moved ::LookupBlockIndex to become a member function of BlockManager. This commit is split out from that one since it can be expressed nicely as a scripted-diff. -BEGIN VERIFY SCRIPT- find_regex='LookupBlockIndex' \ && git grep -l -E "$find_regex" -- src \ | grep -v '^src/validation\.\(cpp\|h\)$' \ | xargs sed -i -E "s@${find_regex}@g_chainman.m_blockman.LookupBlockIndex@g" -END VERIFY SCRIPT-
2021-01-28net_processing: log txrelay flag from version messageAnthony Towns
2021-01-28net_processing: additional debug logging for ignored messagesAnthony Towns
2021-01-28net, net_processing: log disconnect reasons with -debug=netAnthony Towns
2021-01-23Call CaptureMessage at appropriate locationsTroy Giorshev
These calls are toggled by a debug-only "capturemessages" flag. Default disabled.
2021-01-17Clean PushMessage and ProcessMessagesTroy Giorshev
This brings PushMessage and ProcessMessages further in line with the style guide by fixing their if statements. LogMessage is later called, inside an if statement, inside both of these methods.
2021-01-13Merge #20811: refactor: move net_processing implementation details out of headerWladimir J. van der Laan
c97f70c861ac6959b8116a9bca3031edeb2b2aaa net_processing: move Peer definition to .cpp (Anthony Towns) e0f2e6d2df7117a8dbf17c63c5149fc53a6fe2b2 net_processing: move PeerManagerImpl into cpp file (Anthony Towns) a568b82febb3ecbd5ebb7c3f9da27e762b0c68f6 net_processing: split PeerManager into interface and implementation classes (Anthony Towns) 0df3d3fd6bbbd0e06116797177ba797580553250 net_processing: make more of PeerManager private (Anthony Towns) 0d246a59b606c51728d10cb70004a6eedb951bca net, net_processing: move NetEventsInterface method docs to net.h (Anthony Towns) Pull request description: Moves the implementation details of `PeerManager` and all of `struct Peer` into net_processing.cpp. ACKs for top commit: jnewbery: ACK c97f70c861ac6959b8116a9bca3031edeb2b2aaa Sjors: ACK c97f70c861ac6959b8116a9bca3031edeb2b2aaa laanwj: Code review ACK c97f70c861ac6959b8116a9bca3031edeb2b2aaa vasild: ACK c97f70c861ac6959b8116a9bca3031edeb2b2aaa Tree-SHA512: 2e081e491d981c61bd78436a6a6c2eb41d3c2d86a1a8ef9d4d6f801b82cb64a8bf707a96db3429418d1704cffb60a657d1037a0336cbc8173fb79aef9eb72001
2021-01-09net_processing: move Peer definition to .cppAnthony Towns
2021-01-09net_processing: move PeerManagerImpl into cpp fileAnthony Towns
2021-01-09net_processing: split PeerManager into interface and implementation classesAnthony Towns
2021-01-07net: Remove unused cs_feeFilterMarcoFalke
2021-01-02refactor: Remove nMyStartingHeight from CNode/ConnmanMarcoFalke
2020-12-26[rpc] Remove deprecated "banscore" field from getpeerinfoAmiti Uttarwar
2020-12-25Merge #15451: [doc] clarify getdata limit after #14897MarcoFalke
c119ba3c9b321a7f4418860741b3f69173e9c891 [doc] clarify getdata limit after #14897 (Michael Polzer) Pull request description: GETDATA is limited to blocks and transactions now and can't be used for other non-block data ACKs for top commit: laanwj: ACK c119ba3c9b321a7f4418860741b3f69173e9c891 theStack: ACK https://github.com/bitcoin/bitcoin/pull/15451/commits/c119ba3c9b321a7f4418860741b3f69173e9c891 benthecarman: ACK c119ba3c9b321a7f4418860741b3f69173e9c891 Tree-SHA512: d6e9c109bcce4ef004ec83a9ec591163279476524dec97ed5f5c34e322dca35af66a168f0878ff972bbcec79d81623903f3619fedf8f88cdced3f3f66a779173
2020-12-22[net processing] Remove dropmessagestestJohn Newbery
-dropmessagestest is a command line option that causes 1 in n received messages to be dropped. The Bitcoin P2P protocol is stateful and in general cannot handle messages being dropped. Dropped version/verack/ping/pong messages will cause the connection to time out and be torn down. Other dropped messages may also cause the peer to believe that the peer has stalled and tear down the connection. It seems difficult to uncover any actual issues with -dropmessagestest, and any coverage that could be generated would probably be easier to trigger with fuzz testing.
2020-12-20[net processing] Guard m_continuation_block with m_block_inv_mutexJohn Newbery
2020-12-20[net processing] Move hashContinue to net processingJohn Newbery
Also rename to m_continuation_block to better communicate meaning.