Skip to content

Commit 0865ab8

Browse files
committed
test: check more details on zmq raw block response
1 parent 38265cc commit 0865ab8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/functional/interface_zmq.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""Test the ZMQ notification interface."""
66
import struct
77
from time import sleep
8+
from io import BytesIO
89

910
from test_framework.address import (
1011
ADDRESS_BCRT1_P2WSH_OP_TRUE,
@@ -17,6 +18,7 @@
1718
)
1819
from test_framework.test_framework import BitcoinTestFramework
1920
from test_framework.messages import (
21+
CBlock,
2022
hash256,
2123
tx_from_hex,
2224
)
@@ -203,8 +205,13 @@ def test_basic(self):
203205
assert_equal(tx.hash, txid.hex())
204206

205207
# Should receive the generated raw block.
206-
block = rawblock.receive()
207-
assert_equal(genhashes[x], hash256_reversed(block[:80]).hex())
208+
hex = rawblock.receive()
209+
block = CBlock()
210+
block.deserialize(BytesIO(hex))
211+
assert block.is_valid()
212+
assert_equal(block.vtx[0].hash, tx.hash)
213+
assert_equal(len(block.vtx), 1)
214+
assert_equal(genhashes[x], hash256_reversed(hex[:80]).hex())
208215

209216
# Should receive the generated block hash.
210217
hash = hashblock.receive().hex()

0 commit comments

Comments
 (0)