I am learning about the functional test framework in Bitcoin Core. I am seeing the terms "node", "peer" and "mininode" being used. How are these defined and how are they different?
1 Answer
When you run P2P functional tests you are spinning up regtest nodes (running simplified Python code) that connect to your full node (running the full C++ code) to test P2P functionality.
As John Newbery outlines here:
A node is the bitcoind instance. This is the thing whose behavior is being tested. Each bitcoind node is managed by a Python TestNode object which is used to start/stop the node, manage the node's data directory, read state about the node (eg process status, log file), and interact with the node over different interfaces.
One of the interfaces that we can use to interact with the node is the P2P interface. Each connection to a node using this interface is managed by a Python P2PInterface or derived object (which is owned by the TestNode object). We can open zero, one or many P2P connections to each bitcoind node. The node sees these connections as peers.
For historic reasons, the word mininode has been used to refer to those P2P interface objects that we use to connect to the bitcoind node (the code was originally taken from the 'mini-node' branch of https://github.com/jgarzik/pynode/tree/mini-node).
However, this PR 19760 (merged in August 2020) has removed all references to mininode and so no code or current docs in the Bitcoin Core repo currently refer to mininode. Obviously previous PRs and outdated documentation outside the repo will still refer to mininode.