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 collections import deque | |||||
import random | import random | ||||
import time | import time | ||||
from collections import deque | |||||
from test_framework.blocktools import ( | from test_framework.blocktools import ( | ||||
create_block, | create_block, | ||||
create_coinbase, | create_coinbase, | ||||
create_tx_with_script, | create_tx_with_script, | ||||
make_conform_to_ctor, | make_conform_to_ctor, | ||||
) | ) | ||||
from test_framework.cdefs import ONE_MEGABYTE | from test_framework.cdefs import ONE_MEGABYTE | ||||
from test_framework.messages import ( | from test_framework.messages import ( | ||||
COutPoint, | COutPoint, | ||||
CTransaction, | CTransaction, | ||||
CTxIn, | CTxIn, | ||||
CTxOut, | CTxOut, | ||||
HeaderAndShortIDs, | HeaderAndShortIDs, | ||||
msg_cmpctblock, | msg_cmpctblock, | ||||
msg_sendcmpct, | msg_sendcmpct, | ||||
ser_compact_size, | ser_compact_size, | ||||
) | ) | ||||
from test_framework.p2p import ( | from test_framework.p2p import P2PDataStore, P2PInterface, p2p_lock | ||||
p2p_lock, | from test_framework.script import OP_RETURN, OP_TRUE, CScript | ||||
P2PDataStore, | |||||
P2PInterface, | |||||
) | |||||
from test_framework.script import CScript, OP_RETURN, OP_TRUE | |||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.txtools import pad_tx | from test_framework.txtools import pad_tx | ||||
from test_framework.util import ( | from test_framework.util import assert_equal, wait_until | ||||
assert_equal, | |||||
wait_until | |||||
) | |||||
class PreviousSpendableOutput(): | class PreviousSpendableOutput(): | ||||
def __init__(self, tx=CTransaction(), n=-1): | def __init__(self, tx=CTransaction(), n=-1): | ||||
self.tx = tx | self.tx = tx | ||||
# the output we're spending | # the output we're spending | ||||
self.n = n | self.n = n | ||||
▲ Show 20 Lines • Show All 309 Lines • Show Last 20 Lines |