mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-09 04:02:25 +01:00
rest: Reject negative outpoint index in getutxos parsing
This commit is contained in:
@@ -201,10 +201,13 @@ class RESTTest (BitcoinTestFramework):
|
||||
json_obj = self.test_rest_request(f"/getutxos/checkmempool/{spending[0]}-{spending[1]}")
|
||||
assert_equal(len(json_obj['utxos']), 1)
|
||||
|
||||
# Do some invalid requests
|
||||
self.log.info("Check some invalid requests")
|
||||
self.test_rest_request("/getutxos", http_method='POST', req_type=ReqType.JSON, body='{"checkmempool', status=400, ret_type=RetType.OBJ)
|
||||
self.test_rest_request("/getutxos", http_method='POST', req_type=ReqType.BIN, body='{"checkmempool', status=400, ret_type=RetType.OBJ)
|
||||
self.test_rest_request("/getutxos/checkmempool", http_method='POST', req_type=ReqType.JSON, status=400, ret_type=RetType.OBJ)
|
||||
self.test_rest_request(f"/getutxos/{spending[0]}_+1", ret_type=RetType.OBJ, status=400)
|
||||
self.test_rest_request(f"/getutxos/{spending[0]}-+1", ret_type=RetType.OBJ, status=400)
|
||||
self.test_rest_request(f"/getutxos/{spending[0]}--1", ret_type=RetType.OBJ, status=400)
|
||||
|
||||
# Test limits
|
||||
long_uri = '/'.join([f"{txid}-{n_}" for n_ in range(20)])
|
||||
|
||||
Reference in New Issue
Block a user