aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-10-07 11:45:53 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-10-12 09:10:19 +0200
commitfa8d49289479b8eda7ba7530515c414d1cd566a3 (patch)
tree668eff074be0a10a4290ed495826837172689dfc /test
parent8df7eee5e1c8ad6b224aa00bcfd7a04a974362c4 (diff)
downloadbitcoin-fa8d49289479b8eda7ba7530515c414d1cd566a3.tar.xz
rest: Return error when header count is not integral
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/interface_rest.py7
-rwxr-xr-xtest/lint/lint-locale-dependence.sh1
2 files changed, 7 insertions, 1 deletions
diff --git a/test/functional/interface_rest.py b/test/functional/interface_rest.py
index e0716fc54a..adc33bd9df 100755
--- a/test/functional/interface_rest.py
+++ b/test/functional/interface_rest.py
@@ -279,6 +279,13 @@ class RESTTest (BitcoinTestFramework):
json_obj = self.test_rest_request(f"/headers/5/{bb_hash}")
assert_equal(len(json_obj), 5) # now we should have 5 header objects
+ # Test number parsing
+ for num in ['5a', '-5', '0', '2001', '99999999999999999999999999999999999']:
+ assert_equal(
+ bytes(f'Header count out of range: {num}\r\n', 'ascii'),
+ self.test_rest_request(f"/headers/{num}/{bb_hash}", ret_type=RetType.BYTES, status=400),
+ )
+
self.log.info("Test tx inclusion in the /mempool and /block URIs")
# Make 3 tx and mine them on node 1
diff --git a/test/lint/lint-locale-dependence.sh b/test/lint/lint-locale-dependence.sh
index f82d82f890..34022ece35 100755
--- a/test/lint/lint-locale-dependence.sh
+++ b/test/lint/lint-locale-dependence.sh
@@ -43,7 +43,6 @@ export LC_ALL=C
KNOWN_VIOLATIONS=(
"src/bitcoin-tx.cpp.*stoul"
"src/dbwrapper.cpp:.*vsnprintf"
- "src/rest.cpp:.*strtol"
"src/test/dbwrapper_tests.cpp:.*snprintf"
"src/test/fuzz/locale.cpp"
"src/test/fuzz/string.cpp"