mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
[test] Remove final references to mininode
This commit is contained in:
parent
5e8df3312e
commit
d5800da519
8 changed files with 17 additions and 13 deletions
|
@ -127,8 +127,8 @@ Base class for functional tests.
|
||||||
#### [util.py](test_framework/util.py)
|
#### [util.py](test_framework/util.py)
|
||||||
Generally useful functions.
|
Generally useful functions.
|
||||||
|
|
||||||
#### [mininode.py](test_framework/mininode.py)
|
#### [p2p.py](test_framework/p2p.py)
|
||||||
Basic code to support P2P connectivity to a bitcoind.
|
Test objects for interacting with a bitcoind node over the p2p interface.
|
||||||
|
|
||||||
#### [script.py](test_framework/script.py)
|
#### [script.py](test_framework/script.py)
|
||||||
Utilities for manipulating transaction scripts (originally from python-bitcoinlib)
|
Utilities for manipulating transaction scripts (originally from python-bitcoinlib)
|
||||||
|
|
|
@ -167,7 +167,7 @@ class ExampleTest(BitcoinTestFramework):
|
||||||
height = self.nodes[0].getblockcount()
|
height = self.nodes[0].getblockcount()
|
||||||
|
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
# Use the mininode and blocktools functionality to manually build a block
|
# Use the blocktools functionality to manually build a block.
|
||||||
# Calling the generate() rpc is easier, but this allows us to exactly
|
# Calling the generate() rpc is easier, but this allows us to exactly
|
||||||
# control the blocks and transactions.
|
# control the blocks and transactions.
|
||||||
block = create_block(self.tip, create_coinbase(height+1), self.block_time)
|
block = create_block(self.tip, create_coinbase(height+1), self.block_time)
|
||||||
|
|
|
@ -53,7 +53,7 @@ from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import assert_equal
|
from test_framework.util import assert_equal
|
||||||
from data import invalid_txs
|
from data import invalid_txs
|
||||||
|
|
||||||
# Use this class for tests that require behavior other than normal "mininode" behavior.
|
# Use this class for tests that require behavior other than normal p2p behavior.
|
||||||
# For now, it is used to serialize a bloated varint (b64).
|
# For now, it is used to serialize a bloated varint (b64).
|
||||||
class CBrokenBlock(CBlock):
|
class CBrokenBlock(CBlock):
|
||||||
def initialize(self, base_block):
|
def initialize(self, base_block):
|
||||||
|
|
|
@ -109,7 +109,7 @@ class P2PPermissionsTests(BitcoinTestFramework):
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
self.log.debug("Create a connection from a forcerelay peer that rebroadcasts raw txs")
|
self.log.debug("Create a connection from a forcerelay peer that rebroadcasts raw txs")
|
||||||
# A python mininode is needed to send the raw transaction directly. If a full node was used, it could only
|
# A test framework p2p connection is needed to send the raw transaction directly. If a full node was used, it could only
|
||||||
# rebroadcast via the inv-getdata mechanism. However, even for forcerelay connections, a full node would
|
# rebroadcast via the inv-getdata mechanism. However, even for forcerelay connections, a full node would
|
||||||
# currently not request a txid that is already in the mempool.
|
# currently not request a txid that is already in the mempool.
|
||||||
self.restart_node(1, extra_args=["-whitelist=forcerelay@127.0.0.1"])
|
self.restart_node(1, extra_args=["-whitelist=forcerelay@127.0.0.1"])
|
||||||
|
|
|
@ -153,8 +153,8 @@ class TestP2PConn(P2PInterface):
|
||||||
self.lastgetdata = []
|
self.lastgetdata = []
|
||||||
self.wtxidrelay = wtxidrelay
|
self.wtxidrelay = wtxidrelay
|
||||||
|
|
||||||
# Avoid sending out msg_getdata in the mininode thread as a reply to invs.
|
# Don't send getdata message replies to invs automatically.
|
||||||
# They are not needed and would only lead to races because we send msg_getdata out in the test thread
|
# We'll send the getdata messages explicitly in the test logic.
|
||||||
def on_inv(self, message):
|
def on_inv(self, message):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ from test_framework.util import hex_str_to_bytes, assert_equal
|
||||||
|
|
||||||
MIN_VERSION_SUPPORTED = 60001
|
MIN_VERSION_SUPPORTED = 60001
|
||||||
MY_VERSION = 70016 # past wtxid relay
|
MY_VERSION = 70016 # past wtxid relay
|
||||||
MY_SUBVERSION = b"/python-mininode-tester:0.0.3/"
|
MY_SUBVERSION = b"/python-p2p-tester:0.0.3/"
|
||||||
MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37)
|
MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37)
|
||||||
|
|
||||||
MAX_LOCATOR_SZ = 101
|
MAX_LOCATOR_SZ = 101
|
||||||
|
|
|
@ -4,10 +4,14 @@
|
||||||
# Copyright (c) 2010-2020 The Bitcoin Core developers
|
# Copyright (c) 2010-2020 The Bitcoin Core developers
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
"""Bitcoin P2P network half-a-node.
|
"""Test objects for interacting with a bitcoind node over the p2p protocol.
|
||||||
|
|
||||||
This python code was modified from ArtForz' public domain half-a-node, as
|
The P2PInterface objects interact with the bitcoind nodes under test using the
|
||||||
found in the mini-node branch of http://github.com/jgarzik/pynode.
|
node's p2p interface. They can be used to send messages to the node, and
|
||||||
|
callbacks can be registered that execute when messages are received from the
|
||||||
|
node. Messages are sent to/received from the node on an asyncio event loop.
|
||||||
|
State held inside the objects must be guarded by the p2p_lock to avoid data
|
||||||
|
races between the main testing thread and the event loop.
|
||||||
|
|
||||||
P2PConnection: A low-level connection object to a node's P2P interface
|
P2PConnection: A low-level connection object to a node's P2P interface
|
||||||
P2PInterface: A high-level interface object for communicating to a node over P2P
|
P2PInterface: A high-level interface object for communicating to a node over P2P
|
||||||
|
|
|
@ -551,7 +551,7 @@ class TestNode():
|
||||||
assert self.p2ps, self._node_msg("No p2p connection")
|
assert self.p2ps, self._node_msg("No p2p connection")
|
||||||
return self.p2ps[0]
|
return self.p2ps[0]
|
||||||
|
|
||||||
def num_connected_mininodes(self):
|
def num_test_p2p_connections(self):
|
||||||
"""Return number of test framework p2p connections to the node."""
|
"""Return number of test framework p2p connections to the node."""
|
||||||
return len([peer for peer in self.getpeerinfo() if peer['subver'] == MY_SUBVERSION])
|
return len([peer for peer in self.getpeerinfo() if peer['subver'] == MY_SUBVERSION])
|
||||||
|
|
||||||
|
@ -560,7 +560,7 @@ class TestNode():
|
||||||
for p in self.p2ps:
|
for p in self.p2ps:
|
||||||
p.peer_disconnect()
|
p.peer_disconnect()
|
||||||
del self.p2ps[:]
|
del self.p2ps[:]
|
||||||
wait_until(lambda: self.num_connected_mininodes() == 0)
|
wait_until(lambda: self.num_test_p2p_connections() == 0)
|
||||||
|
|
||||||
|
|
||||||
class TestNodeCLIAttr:
|
class TestNodeCLIAttr:
|
||||||
|
|
Loading…
Add table
Reference in a new issue