Skip to content

Commit e80e5b3

Browse files
committed
Merge #19760: test: Remove confusing mininode terminology
d5800da [test] Remove final references to mininode (John Newbery) 5e8df33 test: resort imports (John Newbery) 85165d4 scripted-diff: Rename mininode to p2p (John Newbery) 9e2897d scripted-diff: Rename mininode_lock to p2p_lock (John Newbery) Pull request description: New contributors are often confused by the terminology in the test framework, and what the difference between a _node_ and a _peer_ is. To summarize: - a 'node' is a 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 that name has proved to be confusing for new contributors, so rename the remaining references. ACKs for top commit: amitiuttarwar: ACK d5800da MarcoFalke: ACK d5800da 🚞 Tree-SHA512: 2c46c2ac3c4278b6e3c647cfd8108428a41e80788fc4f0e386e5b0c47675bc687d94779496c09a3e5ea1319617295be10c422adeeff2d2bd68378e00e0eeb5de
2 parents 6a2ba62 + d5800da commit e80e5b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+165
-165
lines changed

test/functional/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ Base class for functional tests.
127127
#### [util.py](test_framework/util.py)
128128
Generally useful functions.
129129

130-
#### [mininode.py](test_framework/mininode.py)
131-
Basic code to support P2P connectivity to a bitcoind.
130+
#### [p2p.py](test_framework/p2p.py)
131+
Test objects for interacting with a bitcoind node over the p2p interface.
132132

133133
#### [script.py](test_framework/script.py)
134134
Utilities for manipulating transaction scripts (originally from python-bitcoinlib)

test/functional/example_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
# Avoid wildcard * imports
1717
from test_framework.blocktools import (create_block, create_coinbase)
1818
from test_framework.messages import CInv, MSG_BLOCK
19-
from test_framework.mininode import (
19+
from test_framework.p2p import (
2020
P2PInterface,
21-
mininode_lock,
2221
msg_block,
2322
msg_getdata,
23+
p2p_lock,
2424
)
2525
from test_framework.test_framework import BitcoinTestFramework
2626
from test_framework.util import (
@@ -167,7 +167,7 @@ def run_test(self):
167167
height = self.nodes[0].getblockcount()
168168

169169
for _ in range(10):
170-
# Use the mininode and blocktools functionality to manually build a block
170+
# Use the blocktools functionality to manually build a block.
171171
# Calling the generate() rpc is easier, but this allows us to exactly
172172
# control the blocks and transactions.
173173
block = create_block(self.tip, create_coinbase(height+1), self.block_time)
@@ -203,13 +203,13 @@ def run_test(self):
203203

204204
# wait_until() will loop until a predicate condition is met. Use it to test properties of the
205205
# P2PInterface objects.
206-
wait_until(lambda: sorted(blocks) == sorted(list(self.nodes[2].p2p.block_receive_map.keys())), timeout=5, lock=mininode_lock)
206+
wait_until(lambda: sorted(blocks) == sorted(list(self.nodes[2].p2p.block_receive_map.keys())), timeout=5, lock=p2p_lock)
207207

208208
self.log.info("Check that each block was received only once")
209209
# The network thread uses a global lock on data access to the P2PConnection objects when sending and receiving
210210
# messages. The test thread should acquire the global lock before accessing any P2PConnection data to avoid locking
211211
# and synchronization issues. Note wait_until() acquires this global lock when testing the predicate.
212-
with mininode_lock:
212+
with p2p_lock:
213213
for block in self.nodes[2].p2p.block_receive_map.values():
214214
assert_equal(block, 1)
215215

test/functional/feature_assumevalid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
msg_block,
4343
msg_headers,
4444
)
45-
from test_framework.mininode import P2PInterface
45+
from test_framework.p2p import P2PInterface
4646
from test_framework.script import (CScript, OP_TRUE)
4747
from test_framework.test_framework import BitcoinTestFramework
4848
from test_framework.util import assert_equal

test/functional/feature_block.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
uint256_from_compact,
2727
uint256_from_str,
2828
)
29-
from test_framework.mininode import P2PDataStore
29+
from test_framework.p2p import P2PDataStore
3030
from test_framework.script import (
3131
CScript,
3232
MAX_SCRIPT_ELEMENT_SIZE,
@@ -53,7 +53,7 @@
5353
from test_framework.util import assert_equal
5454
from data import invalid_txs
5555

56-
# Use this class for tests that require behavior other than normal "mininode" behavior.
56+
# Use this class for tests that require behavior other than normal p2p behavior.
5757
# For now, it is used to serialize a bloated varint (b64).
5858
class CBrokenBlock(CBlock):
5959
def initialize(self, base_block):

test/functional/feature_cltv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from test_framework.blocktools import create_coinbase, create_block, create_transaction
1212
from test_framework.messages import CTransaction, msg_block, ToHex
13-
from test_framework.mininode import P2PInterface
13+
from test_framework.p2p import P2PInterface
1414
from test_framework.script import CScript, OP_1NEGATE, OP_CHECKLOCKTIMEVERIFY, OP_DROP, CScriptNum
1515
from test_framework.test_framework import BitcoinTestFramework
1616
from test_framework.util import (

test/functional/feature_csv_activation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
from test_framework.blocktools import create_coinbase, create_block, create_transaction
4646
from test_framework.messages import ToHex, CTransaction
47-
from test_framework.mininode import P2PDataStore
47+
from test_framework.p2p import P2PDataStore
4848
from test_framework.script import (
4949
CScript,
5050
OP_CHECKSEQUENCEVERIFY,

test/functional/feature_dersig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from test_framework.blocktools import create_coinbase, create_block, create_transaction
1111
from test_framework.messages import msg_block
12-
from test_framework.mininode import P2PInterface
12+
from test_framework.p2p import P2PInterface
1313
from test_framework.script import CScript
1414
from test_framework.test_framework import BitcoinTestFramework
1515
from test_framework.util import (

test/functional/feature_maxuploadtarget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import time
1515

1616
from test_framework.messages import CInv, MSG_BLOCK, msg_getdata
17-
from test_framework.mininode import P2PInterface
17+
from test_framework.p2p import P2PInterface
1818
from test_framework.test_framework import BitcoinTestFramework
1919
from test_framework.util import assert_equal, mine_large_block
2020

test/functional/feature_versionbits_warning.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from test_framework.blocktools import create_block, create_coinbase
1414
from test_framework.messages import msg_block
15-
from test_framework.mininode import P2PInterface, mininode_lock
15+
from test_framework.p2p import p2p_lock, P2PInterface
1616
from test_framework.test_framework import BitcoinTestFramework
1717
from test_framework.util import wait_until
1818

@@ -91,7 +91,7 @@ def run_test(self):
9191

9292
# Generating one block guarantees that we'll get out of IBD
9393
node.generatetoaddress(1, node_deterministic_address)
94-
wait_until(lambda: not node.getblockchaininfo()['initialblockdownload'], timeout=10, lock=mininode_lock)
94+
wait_until(lambda: not node.getblockchaininfo()['initialblockdownload'], timeout=10, lock=p2p_lock)
9595
# Generating one more block will be enough to generate an error.
9696
node.generatetoaddress(1, node_deterministic_address)
9797
# Check that get*info() shows the versionbits unknown rules warning

test/functional/mempool_packages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from decimal import Decimal
88

99
from test_framework.messages import COIN
10-
from test_framework.mininode import P2PTxInvStore
10+
from test_framework.p2p import P2PTxInvStore
1111
from test_framework.test_framework import BitcoinTestFramework
1212
from test_framework.util import (
1313
assert_equal,

0 commit comments

Comments
 (0)