aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormerge-script <fanquake@gmail.com>2024-05-08 16:15:00 +0800
committermerge-script <fanquake@gmail.com>2024-05-08 16:15:00 +0800
commit43a66c55ec8770cf7c21112aac9b997f3f2fb704 (patch)
tree3c909e7655454231a409957aec4cee72d736a6d7 /test
parent74f517b4411d80afa7733c088da961e9c736a97d (diff)
parentee67bba76cca2355541f99bb731f58479981b29e (diff)
downloadbitcoin-43a66c55ec8770cf7c21112aac9b997f3f2fb704.tar.xz
Merge bitcoin/bitcoin#30053: test: added test coverage to loadtxoutset could not open file
ee67bba76cca2355541f99bb731f58479981b29e test: added test coverage to loadtxoutset (kevkevin) Pull request description: The functional test coverage did not cover the rpc error of "Couldn't open file..." for loadtxoutset and this test adds coverage for it This adds coverage to this line https://github.com/bitcoin/bitcoin/blob/master/src/rpc/blockchain.cpp#L2777 ACKs for top commit: maflcko: ACK ee67bba76cca2355541f99bb731f58479981b29e davidgumberg: LGTM ACK https://github.com/bitcoin/bitcoin/pull/30053/commits/ee67bba76cca2355541f99bb731f58479981b29e rkrux: ACK [ee67bba](https://github.com/bitcoin/bitcoin/pull/30053/commits/ee67bba76cca2355541f99bb731f58479981b29e) alfonsoromanz: ACK ee67bba76cca2355541f99bb731f58479981b29e. Code looks good to me. I also ran `test/functional/feature_assumeutxo.py` to make sure all tests passes, including this one. tdb3: ACK for ee67bba76cca2355541f99bb731f58479981b29e Tree-SHA512: 210a7eb928f625d2a8d9acb63ee83cb4aaec9c267e5a0c52ad219c2935466e2cdc68667e30ad29566e6060981587e5bec42805d296f6e60f9b3b13f3330575f2
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/feature_assumeutxo.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/functional/feature_assumeutxo.py b/test/functional/feature_assumeutxo.py
index 2842d82d80..58a5442f4e 100755
--- a/test/functional/feature_assumeutxo.py
+++ b/test/functional/feature_assumeutxo.py
@@ -155,6 +155,12 @@ class AssumeutxoTest(BitcoinTestFramework):
self.restart_node(2, extra_args=self.extra_args[2])
+ def test_invalid_file_path(self):
+ self.log.info("Test bitcoind should fail when file path is invalid.")
+ node = self.nodes[0]
+ path = node.datadir_path / node.chain / "invalid" / "path"
+ assert_raises_rpc_error(-8, "Couldn't open file {} for reading.".format(path), node.loadtxoutset, path)
+
def run_test(self):
"""
Bring up two (disconnected) nodes, mine some new blocks on the first,
@@ -239,6 +245,7 @@ class AssumeutxoTest(BitcoinTestFramework):
self.test_invalid_mempool_state(dump_output['path'])
self.test_invalid_snapshot_scenarios(dump_output['path'])
self.test_invalid_chainstate_scenarios()
+ self.test_invalid_file_path()
self.log.info(f"Loading snapshot into second node from {dump_output['path']}")
loaded = n1.loadtxoutset(dump_output['path'])