Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_compactblocks.py
Show First 20 Lines • Show All 738 Lines • ▼ Show 20 Lines | def test_compactblocks_not_at_tip(self, node, test_node): | ||||
with mininode_lock: | with mininode_lock: | ||||
assert "blocktxn" not in test_node.last_message | assert "blocktxn" not in test_node.last_message | ||||
def test_end_to_end_block_relay(self, node, listeners): | def test_end_to_end_block_relay(self, node, listeners): | ||||
utxo = self.utxos.pop(0) | utxo = self.utxos.pop(0) | ||||
block, _ = self.build_block_with_transactions(node, utxo, 10) | block, _ = self.build_block_with_transactions(node, utxo, 10) | ||||
[l.clear_block_announcement() for l in listeners] | [listener.clear_block_announcement() for listener in listeners] | ||||
node.submitblock(ToHex(block)) | node.submitblock(ToHex(block)) | ||||
for l in listeners: | for listener in listeners: | ||||
wait_until(lambda: l.received_block_announcement(), | wait_until(lambda: listener.received_block_announcement(), | ||||
timeout=30, lock=mininode_lock) | timeout=30, lock=mininode_lock) | ||||
with mininode_lock: | with mininode_lock: | ||||
for l in listeners: | for listener in listeners: | ||||
assert "cmpctblock" in l.last_message | assert "cmpctblock" in listener.last_message | ||||
l.last_message["cmpctblock"].header_and_shortids.header.calc_sha256( | listener.last_message["cmpctblock"].header_and_shortids.header.calc_sha256( | ||||
) | ) | ||||
assert_equal( | assert_equal( | ||||
l.last_message["cmpctblock"].header_and_shortids.header.sha256, block.sha256) | listener.last_message["cmpctblock"].header_and_shortids.header.sha256, block.sha256) | ||||
# Test that we don't get disconnected if we relay a compact block with valid header, | # Test that we don't get disconnected if we relay a compact block with valid header, | ||||
# but invalid transactions. | # but invalid transactions. | ||||
def test_invalid_tx_in_compactblock(self, node, test_node): | def test_invalid_tx_in_compactblock(self, node, test_node): | ||||
assert len(self.utxos) | assert len(self.utxos) | ||||
utxo = self.utxos[0] | utxo = self.utxos[0] | ||||
block, ordered_txs = self.build_block_with_transactions(node, utxo, 5) | block, ordered_txs = self.build_block_with_transactions(node, utxo, 5) | ||||
▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines |