Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_unrequested_blocks.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 | ||||
# 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. | ||||
from test_framework.mininode import * | import os | ||||
from test_framework.test_framework import BitcoinTestFramework | |||||
from test_framework.util import * | |||||
import time | import time | ||||
from test_framework.blocktools import create_block, create_coinbase, create_transaction | |||||
from test_framework.blocktools import ( | |||||
create_block, | |||||
create_coinbase, | |||||
create_transaction, | |||||
) | |||||
from test_framework.messages import ( | |||||
CBlockHeader, | |||||
CInv, | |||||
msg_block, | |||||
msg_headers, | |||||
msg_inv, | |||||
) | |||||
from test_framework.mininode import ( | |||||
mininode_lock, | |||||
network_thread_join, | |||||
network_thread_start, | |||||
P2PInterface, | |||||
) | |||||
from test_framework.test_framework import BitcoinTestFramework | |||||
from test_framework.util import ( | |||||
assert_equal, | |||||
assert_raises_rpc_error, | |||||
connect_nodes, | |||||
sync_blocks, | |||||
) | |||||
''' | ''' | ||||
AcceptBlockTest -- test processing of unrequested blocks. | AcceptBlockTest -- test processing of unrequested blocks. | ||||
Setup: two nodes, node0+node1, not connected to each other. Node1 will have | Setup: two nodes, node0+node1, not connected to each other. Node1 will have | ||||
nMinimumChainWork set to 0x10, so it won't process low-work unrequested blocks. | nMinimumChainWork set to 0x10, so it won't process low-work unrequested blocks. | ||||
We have one P2PInterface connection to node0 called test_node, and one to node1 | We have one P2PInterface connection to node0 called test_node, and one to node1 | ||||
▲ Show 20 Lines • Show All 334 Lines • Show Last 20 Lines |