Fix tests that depend on old block header format
Changes to bloom tests were done by running the following commands:
sed -i 's/\(CDataStream stream(ParseHex(".\{152\}\)\(.\{8\}\)/\100000000000000000000000000000000000000000000000000000000\200/' src/test/bloom_tests.cpp
sed -i 's/\(vector<unsigned char> vch = ParseHex(".\{152\}\)\(.\{8\}\)/\100000000000000000000000000000000000000000000000000000000\200/' src/test/bloom_tests.cpp
and then reverting the single change to the transaction line.
This commit is contained in:
@@ -206,33 +206,40 @@ class RESTTest (BitcoinTestFramework):
|
|||||||
# /rest/block/ #
|
# /rest/block/ #
|
||||||
################
|
################
|
||||||
|
|
||||||
|
# Block header length of 237 is:
|
||||||
|
# - 76 bytes: regular fields
|
||||||
|
# - 32 bytes: nonce
|
||||||
|
# - 129 bytes: Equihash solution vector:
|
||||||
|
# - 1 byte vector length
|
||||||
|
# - 2^k 4-byte indices
|
||||||
|
|
||||||
# check binary format
|
# check binary format
|
||||||
response = http_get_call(url.hostname, url.port, '/rest/block/'+bb_hash+self.FORMAT_SEPARATOR+"bin", "", True)
|
response = http_get_call(url.hostname, url.port, '/rest/block/'+bb_hash+self.FORMAT_SEPARATOR+"bin", "", True)
|
||||||
assert_equal(response.status, 200)
|
assert_equal(response.status, 200)
|
||||||
assert_greater_than(int(response.getheader('content-length')), 80)
|
assert_greater_than(int(response.getheader('content-length')), 237)
|
||||||
response_str = response.read()
|
response_str = response.read()
|
||||||
|
|
||||||
# compare with block header
|
# compare with block header
|
||||||
response_header = http_get_call(url.hostname, url.port, '/rest/headers/1/'+bb_hash+self.FORMAT_SEPARATOR+"bin", "", True)
|
response_header = http_get_call(url.hostname, url.port, '/rest/headers/1/'+bb_hash+self.FORMAT_SEPARATOR+"bin", "", True)
|
||||||
assert_equal(response_header.status, 200)
|
assert_equal(response_header.status, 200)
|
||||||
assert_equal(int(response_header.getheader('content-length')), 80)
|
assert_equal(int(response_header.getheader('content-length')), 237)
|
||||||
response_header_str = response_header.read()
|
response_header_str = response_header.read()
|
||||||
assert_equal(response_str[0:80], response_header_str)
|
assert_equal(response_str[0:237], response_header_str)
|
||||||
|
|
||||||
# check block hex format
|
# check block hex format
|
||||||
response_hex = http_get_call(url.hostname, url.port, '/rest/block/'+bb_hash+self.FORMAT_SEPARATOR+"hex", "", True)
|
response_hex = http_get_call(url.hostname, url.port, '/rest/block/'+bb_hash+self.FORMAT_SEPARATOR+"hex", "", True)
|
||||||
assert_equal(response_hex.status, 200)
|
assert_equal(response_hex.status, 200)
|
||||||
assert_greater_than(int(response_hex.getheader('content-length')), 160)
|
assert_greater_than(int(response_hex.getheader('content-length')), 474)
|
||||||
response_hex_str = response_hex.read()
|
response_hex_str = response_hex.read()
|
||||||
assert_equal(response_str.encode("hex")[0:160], response_hex_str[0:160])
|
assert_equal(response_str.encode("hex")[0:474], response_hex_str[0:474])
|
||||||
|
|
||||||
# compare with hex block header
|
# compare with hex block header
|
||||||
response_header_hex = http_get_call(url.hostname, url.port, '/rest/headers/1/'+bb_hash+self.FORMAT_SEPARATOR+"hex", "", True)
|
response_header_hex = http_get_call(url.hostname, url.port, '/rest/headers/1/'+bb_hash+self.FORMAT_SEPARATOR+"hex", "", True)
|
||||||
assert_equal(response_header_hex.status, 200)
|
assert_equal(response_header_hex.status, 200)
|
||||||
assert_greater_than(int(response_header_hex.getheader('content-length')), 160)
|
assert_greater_than(int(response_header_hex.getheader('content-length')), 474)
|
||||||
response_header_hex_str = response_header_hex.read()
|
response_header_hex_str = response_header_hex.read()
|
||||||
assert_equal(response_hex_str[0:160], response_header_hex_str[0:160])
|
assert_equal(response_hex_str[0:474], response_header_hex_str[0:474])
|
||||||
assert_equal(response_header_str.encode("hex")[0:160], response_header_hex_str[0:160])
|
assert_equal(response_header_str.encode("hex")[0:474], response_header_hex_str[0:474])
|
||||||
|
|
||||||
# check json format
|
# check json format
|
||||||
json_string = http_get_call(url.hostname, url.port, '/rest/block/'+bb_hash+self.FORMAT_SEPARATOR+'json')
|
json_string = http_get_call(url.hostname, url.port, '/rest/block/'+bb_hash+self.FORMAT_SEPARATOR+'json')
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user