Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-schnorrmultisig-activation.py
Show All 25 Lines | from test_framework.messages import ( | ||||
COutPoint, | COutPoint, | ||||
CTransaction, | CTransaction, | ||||
CTxIn, | CTxIn, | ||||
CTxOut, | CTxOut, | ||||
FromHex, | FromHex, | ||||
ToHex, | ToHex, | ||||
) | ) | ||||
from test_framework.mininode import ( | from test_framework.mininode import ( | ||||
network_thread_join, | |||||
network_thread_start, | |||||
P2PDataStore, | P2PDataStore, | ||||
) | ) | ||||
from test_framework import schnorr | from test_framework import schnorr | ||||
from test_framework.script import ( | from test_framework.script import ( | ||||
CScript, | CScript, | ||||
OP_0, | OP_0, | ||||
OP_1, | OP_1, | ||||
OP_CHECKMULTISIG, | OP_CHECKMULTISIG, | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | def set_test_params(self): | ||||
REPLAY_PROTECTION_START_TIME)]] | REPLAY_PROTECTION_START_TIME)]] | ||||
def bootstrap_p2p(self, *, num_connections=1): | def bootstrap_p2p(self, *, num_connections=1): | ||||
"""Add a P2P connection to the node. | """Add a P2P connection to the node. | ||||
Helper to connect and wait for version handshake.""" | Helper to connect and wait for version handshake.""" | ||||
for _ in range(num_connections): | for _ in range(num_connections): | ||||
self.nodes[0].add_p2p_connection(P2PDataStore()) | self.nodes[0].add_p2p_connection(P2PDataStore()) | ||||
network_thread_start() | |||||
self.nodes[0].p2p.wait_for_verack() | self.nodes[0].p2p.wait_for_verack() | ||||
def reconnect_p2p(self, **kwargs): | def reconnect_p2p(self, **kwargs): | ||||
"""Tear down and bootstrap the P2P connection to the node. | """Tear down and bootstrap the P2P connection to the node. | ||||
The node gets disconnected several times in this test. This helper | The node gets disconnected several times in this test. This helper | ||||
method reconnects the p2p and restarts the network thread.""" | method reconnects the p2p and restarts the network thread.""" | ||||
self.nodes[0].disconnect_p2ps() | self.nodes[0].disconnect_p2ps() | ||||
network_thread_join() | |||||
self.bootstrap_p2p(**kwargs) | self.bootstrap_p2p(**kwargs) | ||||
def getbestblock(self, node): | def getbestblock(self, node): | ||||
"""Get the best block. Register its height so we can use build_block.""" | """Get the best block. Register its height so we can use build_block.""" | ||||
block_height = node.getblockcount() | block_height = node.getblockcount() | ||||
blockhash = node.getblockhash(block_height) | blockhash = node.getblockhash(block_height) | ||||
block = FromHex(CBlock(), node.getblock(blockhash, 0)) | block = FromHex(CBlock(), node.getblock(blockhash, 0)) | ||||
block.calc_sha256() | block.calc_sha256() | ||||
▲ Show 20 Lines • Show All 268 Lines • Show Last 20 Lines |