mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
Merge bitcoin/bitcoin#23835: test: check for invalid listtransactions RPC parameters
c27bba9672test: check for invalid listtransactions RPC parameters (Sebastian Falbesoner) Pull request description: This PR adds missing test coverage for RPC errors that are thrown if invalid parameters are passed to `listtransactions`:887796a5ff/src/wallet/rpc/transactions.cpp (L508)887796a5ff/src/wallet/rpc/transactions.cpp (L524)887796a5ff/src/wallet/rpc/transactions.cpp (L526)ACKs for top commit: shaavan: ACKc27bba9672Tree-SHA512: e5a23590186b4d9663261ff6cea52ac45e9bf2f2ef693c22b3452bb07af9b800fdabc2a94fd2852c686c28214a496d7afe296e41831759f2182feac2482635d0
This commit is contained in:
@@ -16,6 +16,7 @@ from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (
|
||||
assert_array_result,
|
||||
assert_equal,
|
||||
assert_raises_rpc_error,
|
||||
)
|
||||
|
||||
|
||||
@@ -107,6 +108,7 @@ class ListTransactionsTest(BitcoinTestFramework):
|
||||
|
||||
self.run_rbf_opt_in_test()
|
||||
self.run_externally_generated_address_test()
|
||||
self.run_invalid_parameters_test()
|
||||
|
||||
def run_rbf_opt_in_test(self):
|
||||
"""Test the opt-in-rbf flag for sent and received transactions."""
|
||||
@@ -275,6 +277,13 @@ class ListTransactionsTest(BitcoinTestFramework):
|
||||
assert_equal(['pizza2'], self.nodes[0].getaddressinfo(addr2)['labels'])
|
||||
assert_equal(['pizza3'], self.nodes[0].getaddressinfo(addr3)['labels'])
|
||||
|
||||
def run_invalid_parameters_test(self):
|
||||
self.log.info("Test listtransactions RPC parameter validity")
|
||||
assert_raises_rpc_error(-8, 'Label argument must be a valid label name or "*".', self.nodes[0].listtransactions, label="")
|
||||
self.nodes[0].listtransactions(label="*")
|
||||
assert_raises_rpc_error(-8, "Negative count", self.nodes[0].listtransactions, count=-1)
|
||||
assert_raises_rpc_error(-8, "Negative from", self.nodes[0].listtransactions, skip=-1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ListTransactionsTest().main()
|
||||
|
||||
Reference in New Issue
Block a user