Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_block.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. | ||||
"""Test block processing. | |||||
This reimplements tests from the bitcoinj/FullBlockTestGenerator used | |||||
by the pull-tester. | |||||
We use the testing framework in which we expect a particular answer from | |||||
each test. | |||||
""" | |||||
import copy | import copy | ||||
import struct | import struct | ||||
import time | import time | ||||
from test_framework.blocktools import ( | from test_framework.blocktools import ( | ||||
create_block, | create_block, | ||||
create_coinbase, | create_coinbase, | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
from test_framework.util import assert_equal | from test_framework.util import assert_equal | ||||
class PreviousSpendableOutput(): | class PreviousSpendableOutput(): | ||||
def __init__(self, tx=CTransaction(), n=-1): | def __init__(self, tx=CTransaction(), n=-1): | ||||
self.tx = tx | self.tx = tx | ||||
self.n = n # the output we're spending | self.n = n # the output we're spending | ||||
''' | |||||
This reimplements tests from the bitcoinj/FullBlockTestGenerator used | |||||
by the pull-tester. | |||||
We use the testing framework in which we expect a particular answer from | |||||
each test. | |||||
''' | |||||
# Use this class for tests that require behavior other than normal "mininode" behavior. | # Use this class for tests that require behavior other than normal "mininode" 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 __init__(self, header=None): | def __init__(self, header=None): | ||||
super(CBrokenBlock, self).__init__(header) | super(CBrokenBlock, self).__init__(header) | ||||
▲ Show 20 Lines • Show All 1,273 Lines • Show Last 20 Lines |