Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/comptool.py
Show All 25 Lines | |||||
# on_headers: log the chain tip | # on_headers: log the chain tip | ||||
# on_pong: update ping response map (for synchronization) | # on_pong: update ping response map (for synchronization) | ||||
# on_getheaders: provide headers via BlockStore | # on_getheaders: provide headers via BlockStore | ||||
# on_getdata: provide blocks via BlockStore | # on_getdata: provide blocks via BlockStore | ||||
global mininode_lock | global mininode_lock | ||||
class RejectResult(object): | class RejectResult(): | ||||
"""Outcome that expects rejection of a transaction or block.""" | |||||
''' | |||||
Outcome that expects rejection of a transaction or block. | |||||
''' | |||||
def __init__(self, code, reason=b''): | def __init__(self, code, reason=b''): | ||||
self.code = code | self.code = code | ||||
self.reason = reason | self.reason = reason | ||||
def match(self, other): | def match(self, other): | ||||
if self.code != other.code: | if self.code != other.code: | ||||
return False | return False | ||||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | |||||
# will be synced across all connections, and the outcome of the final | # will be synced across all connections, and the outcome of the final | ||||
# block will be tested. | # block will be tested. | ||||
# sync_every_tx: analogous to behavior for sync_every_block, except if outcome | # sync_every_tx: analogous to behavior for sync_every_block, except if outcome | ||||
# on the final tx is None, then contents of entire mempool are compared | # on the final tx is None, then contents of entire mempool are compared | ||||
# across all connections. (If outcome of final tx is specified as true | # across all connections. (If outcome of final tx is specified as true | ||||
# or false, then only the last tx is tested against outcome.) | # or false, then only the last tx is tested against outcome.) | ||||
class TestInstance(object): | class TestInstance(): | ||||
def __init__(self, objects=None, sync_every_block=True, sync_every_tx=False): | def __init__(self, objects=None, sync_every_block=True, sync_every_tx=False): | ||||
self.blocks_and_transactions = objects if objects else [] | self.blocks_and_transactions = objects if objects else [] | ||||
self.sync_every_block = sync_every_block | self.sync_every_block = sync_every_block | ||||
self.sync_every_tx = sync_every_tx | self.sync_every_tx = sync_every_tx | ||||
class TestManager(object): | class TestManager(): | ||||
def __init__(self, testgen, datadir): | def __init__(self, testgen, datadir): | ||||
self.test_generator = testgen | self.test_generator = testgen | ||||
self.connections = [] | self.connections = [] | ||||
self.test_nodes = [] | self.test_nodes = [] | ||||
self.block_store = BlockStore(datadir) | self.block_store = BlockStore(datadir) | ||||
self.tx_store = TxStore(datadir) | self.tx_store = TxStore(datadir) | ||||
self.ping_counter = 1 | self.ping_counter = 1 | ||||
▲ Show 20 Lines • Show All 255 Lines • Show Last 20 Lines |