@@ -198,28 +198,31 @@ def run_test(self):
198198 self .log .info ("Test the /block and /headers URIs" )
199199 bb_hash = self .nodes [0 ].getbestblockhash ()
200200
201+ # Elements note: We stripped nBits and nNonce from headers when in signed block mode
202+ # Each header has a OP_TRUE challenge script
203+
201204 # Check binary format
202205 response = self .test_rest_request ("/block/{}" .format (bb_hash ), req_type = ReqType .BIN , ret_type = RetType .OBJ )
203206 assert_greater_than (int (response .getheader ('content-length' )), 84 )
204207 response_bytes = response .read ()
205208
206209 # Compare with block header
207210 response_header = self .test_rest_request ("/headers/1/{}" .format (bb_hash ), req_type = ReqType .BIN , ret_type = RetType .OBJ )
208- assert_equal (int (response_header .getheader ('content-length' )), 84 )
211+ assert_equal (int (response_header .getheader ('content-length' )), 79 )
209212 response_header_bytes = response_header .read ()
210- assert_equal (response_bytes [:84 ], response_header_bytes )
213+ assert_equal (response_bytes [:79 ], response_header_bytes )
211214
212215 # Check block hex format
213216 response_hex = self .test_rest_request ("/block/{}" .format (bb_hash ), req_type = ReqType .HEX , ret_type = RetType .OBJ )
214- assert_greater_than (int (response_hex .getheader ('content-length' )), 160 )
217+ assert_greater_than (int (response_hex .getheader ('content-length' )), 151 )
215218 response_hex_bytes = response_hex .read ().strip (b'\n ' )
216219 assert_equal (binascii .hexlify (response_bytes ), response_hex_bytes )
217220
218221 # Compare with hex block header
219222 response_header_hex = self .test_rest_request ("/headers/1/{}" .format (bb_hash ), req_type = ReqType .HEX , ret_type = RetType .OBJ )
220- assert_greater_than (int (response_header_hex .getheader ('content-length' )), 160 )
221- response_header_hex_bytes = response_header_hex .read (168 )
222- assert_equal (binascii .hexlify (response_bytes [:84 ]), response_header_hex_bytes )
223+ assert_greater_than (int (response_header_hex .getheader ('content-length' )), 75 * 2 )
224+ response_header_hex_bytes = response_header_hex .read (79 * 2 )
225+ assert_equal (binascii .hexlify (response_bytes [:79 ]), response_header_hex_bytes )
223226
224227 # Check json format
225228 block_json_obj = self .test_rest_request ("/block/{}" .format (bb_hash ))
@@ -232,7 +235,7 @@ def run_test(self):
232235
233236 # Compare with normal RPC block response
234237 rpc_block_json = self .nodes [0 ].getblock (bb_hash )
235- for key in ['hash' , 'confirmations' , 'height' , 'version' , 'merkleroot' , 'time' , 'nonce' , 'bits' , 'difficulty' , 'chainwork' , ' previousblockhash' ]:
238+ for key in ['hash' , 'confirmations' , 'height' , 'version' , 'merkleroot' , 'time' , 'previousblockhash' ]:
236239 assert_equal (json_obj [0 ][key ], rpc_block_json [key ])
237240
238241 # See if we can get 5 headers in one response
0 commit comments