Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-p2p-compactblocks.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2015-2016 The Bitcoin Core developers | # Copyright (c) 2015-2016 The Bitcoin Core developers | ||||
# Copyright (c) 2017 The Bitcoin developers | # Copyright (c) 2017 The Bitcoin 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. | ||||
""" | """ | ||||
This test checks simple acceptance of bigger blocks via p2p. | This test checks simple acceptance of bigger blocks via p2p. | ||||
It is derived from the much more complex p2p-fullblocktest. | It is derived from the much more complex p2p-fullblocktest. | ||||
The intention is that small tests can be derived from this one, or | The intention is that small tests can be derived from this one, or | ||||
this one can be extended, to cover the checks done for bigger blocks | this one can be extended, to cover the checks done for bigger blocks | ||||
(e.g. sigops limits). | (e.g. sigops limits). | ||||
""" | """ | ||||
from test_framework.test_framework import ComparisonTestFramework | from test_framework.test_framework import ComparisonTestFramework | ||||
from test_framework.util import * | from test_framework.util import * | ||||
from test_framework.decorators import * | |||||
from test_framework.comptool import TestManager, TestInstance, RejectResult | from test_framework.comptool import TestManager, TestInstance, RejectResult | ||||
from test_framework.blocktools import * | from test_framework.blocktools import * | ||||
import time | import time | ||||
from test_framework.script import * | from test_framework.script import * | ||||
from test_framework.cdefs import (ONE_MEGABYTE, LEGACY_MAX_BLOCK_SIZE, | from test_framework.cdefs import (ONE_MEGABYTE, LEGACY_MAX_BLOCK_SIZE, | ||||
MAX_BLOCK_SIGOPS_PER_MB, MAX_TX_SIGOPS_COUNT) | MAX_BLOCK_SIGOPS_PER_MB, MAX_TX_SIGOPS_COUNT) | ||||
from collections import deque | from collections import deque | ||||
Show All 31 Lines | def on_headers(self, conn, message): | ||||
x.calc_sha256() | x.calc_sha256() | ||||
def clear_block_data(self): | def clear_block_data(self): | ||||
with mininode_lock: | with mininode_lock: | ||||
self.last_sendcmpct = None | self.last_sendcmpct = None | ||||
self.last_cmpctblock = None | self.last_cmpctblock = None | ||||
@extended | |||||
class FullBlockTest(ComparisonTestFramework): | class FullBlockTest(ComparisonTestFramework): | ||||
# Can either run this test as 1 node with expected answers, or two and compare them. | # Can either run this test as 1 node with expected answers, or two and compare them. | ||||
# Change the "outcome" variable from each TestInstance object to only do | # Change the "outcome" variable from each TestInstance object to only do | ||||
# the comparison. | # the comparison. | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
▲ Show 20 Lines • Show All 288 Lines • Show Last 20 Lines |