What does net_processing (.h and .cpp) cover conceptually in the Bitcoin Core codebase?

1 Answer 1


This was answered by James O'Beirne during a presentation on Bitcoin Core architecture at Bitcoin Edge Dev++ (2018).

net_processing routes P2P messages into validation calls and response P2P messages. It adapts the network layer to the chainstate layer and translates network messages into calls for local state changes.

Much of net_processing is ProcessMessage(), a giant conditional for rendering particular network message types to calls deeper into Bitcoin.

Peers are also penalized based on bad behavior (e.g. sending our node invalid blocks) in net_processing. (git grep Misbehaving to see the various cases where Core keeps tracks of bad behavior).

net is at the bottom of the Bitcoin Core stack and handles network communication with the P2P network. CConMan in net forwards messages to net_processing via CConMan::ThreadMessageHandler.

Net processing uses function calls like ProcessNewBlock() and AcceptToMemoryPool() to call into validation, which is responsible for our view of the block chain and the UTXO set.

net_processing was covered in various Bitcoin Core PR review clubs such as this one on PR 20721 on February 3rd 2021.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.