0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

test: check more details on zmq raw block response

This commit is contained in:
Andrew Toth 2024-03-12 12:47:01 -04:00
parent 38265cc14e
commit 0865ab8712
No known key found for this signature in database
GPG key ID: 60007AFC8938B018

View file

@ -5,6 +5,7 @@
"""Test the ZMQ notification interface."""
import struct
from time import sleep
from io import BytesIO
from test_framework.address import (
ADDRESS_BCRT1_P2WSH_OP_TRUE,
@ -17,6 +18,7 @@ from test_framework.blocktools import (
)
from test_framework.test_framework import BitcoinTestFramework
from test_framework.messages import (
CBlock,
hash256,
tx_from_hex,
)
@ -203,8 +205,13 @@ class ZMQTest (BitcoinTestFramework):
assert_equal(tx.hash, txid.hex())
# Should receive the generated raw block.
block = rawblock.receive()
assert_equal(genhashes[x], hash256_reversed(block[:80]).hex())
hex = rawblock.receive()
block = CBlock()
block.deserialize(BytesIO(hex))
assert block.is_valid()
assert_equal(block.vtx[0].hash, tx.hash)
assert_equal(len(block.vtx), 1)
assert_equal(genhashes[x], hash256_reversed(hex[:80]).hex())
# Should receive the generated block hash.
hash = hashblock.receive().hex()