Changeset View
Changeset View
Standalone View
Standalone View
doc/functional-tests.md
Show First 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | |||||
#### Using the P2P interface | #### Using the P2P interface | ||||
- `messages.py` contains all the definitions for objects that pass | - `messages.py` contains all the definitions for objects that pass | ||||
over the network (`CBlock`, `CTransaction`, etc, along with the network-level | over the network (`CBlock`, `CTransaction`, etc, along with the network-level | ||||
wrappers for them, `msg_block`, `msg_tx`, etc). | wrappers for them, `msg_block`, `msg_tx`, etc). | ||||
- P2P tests have two threads. One thread handles all network communication | - P2P tests have two threads. One thread handles all network communication | ||||
with the bitcoind(s) being tested (using python's asyncore package); the other | with the bitcoind(s) being tested in a callback-based event loop; the other | ||||
implements the test logic. | implements the test logic. | ||||
- `P2PConnection` is the class used to connect to a bitcoind. `P2PInterface` | - `P2PConnection` is the class used to connect to a bitcoind. `P2PInterface` | ||||
contains the higher level logic for processing P2P payloads and connecting to | contains the higher level logic for processing P2P payloads and connecting to | ||||
the Bitcoin Core node application logic. For custom behaviour, subclass the | the Bitcoin Core node application logic. For custom behaviour, subclass the | ||||
P2PInterface object and override the callback methods. | P2PInterface object and override the callback methods. | ||||
- Call `network_thread_start()` after all `P2PInterface` objects are created to | |||||
start the networking thread. (Continue with the test logic in your existing | |||||
thread.) | |||||
- Can be used to write tests where specific P2P protocol behavior is tested. | - Can be used to write tests where specific P2P protocol behavior is tested. | ||||
Examples tests are `p2p_unrequested_blocks.py`, `p2p_compactblocks.py`. | Examples tests are `p2p_unrequested_blocks.py`, `p2p_compactblocks.py`. | ||||
### test-framework modules | ### test-framework modules | ||||
#### [test_framework/authproxy.py](test_framework/authproxy.py) | #### [test_framework/authproxy.py](test_framework/authproxy.py) | ||||
Taken from the [python-bitcoinrpc repository](https://github.com/jgarzik/python-bitcoinrpc). | Taken from the [python-bitcoinrpc repository](https://github.com/jgarzik/python-bitcoinrpc). | ||||
Show All 20 Lines |