Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_compactblocks.py
Show First 20 Lines • Show All 595 Lines • ▼ Show 20 Lines | def test_incorrect_blocktxn_response(self, node, test_node, version): | ||||
for i in [6, 7, 8, 9, 10]: | for i in [6, 7, 8, 9, 10]: | ||||
expected_indices.append(block.vtx.index(ordered_txs[i])) | expected_indices.append(block.vtx.index(ordered_txs[i])) | ||||
assert_equal(absolute_indices, sorted(expected_indices)) | assert_equal(absolute_indices, sorted(expected_indices)) | ||||
# Now give an incorrect response. | # Now give an incorrect response. | ||||
# Note that it's possible for bitcoind to be smart enough to know we're | # Note that it's possible for bitcoind to be smart enough to know we're | ||||
# lying, since it could check to see if the shortid matches what we're | # lying, since it could check to see if the shortid matches what we're | ||||
# sending, and eg disconnect us for misbehavior. If that behavior | # sending, and eg disconnect us for misbehavior. If that behavior | ||||
# change were made, we could just modify this test by having a | # change was made, we could just modify this test by having a | ||||
# different peer provide the block further down, so that we're still | # different peer provide the block further down, so that we're still | ||||
# verifying that the block isn't marked bad permanently. This is good | # verifying that the block isn't marked bad permanently. This is good | ||||
# enough for now. | # enough for now. | ||||
msg = msg_blocktxn() | msg = msg_blocktxn() | ||||
msg.block_transactions = BlockTransactions( | msg.block_transactions = BlockTransactions( | ||||
block.sha256, [ordered_txs[5]] + ordered_txs[7:]) | block.sha256, [ordered_txs[5]] + ordered_txs[7:]) | ||||
test_node.send_and_ping(msg) | test_node.send_and_ping(msg) | ||||
▲ Show 20 Lines • Show All 315 Lines • Show Last 20 Lines |