Skip to content

Commit

Permalink
Merge bitcoin#30053: test: added test coverage to loadtxoutset could …
Browse files Browse the repository at this point in the history
…not open file

ee67bba 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 ee67bba
  davidgumberg:
    LGTM ACK bitcoin@ee67bba
  rkrux:
    ACK [ee67bba](bitcoin@ee67bba)
  alfonsoromanz:
    ACK ee67bba. 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 ee67bba

Tree-SHA512: 210a7eb928f625d2a8d9acb63ee83cb4aaec9c267e5a0c52ad219c2935466e2cdc68667e30ad29566e6060981587e5bec42805d296f6e60f9b3b13f3330575f2
  • Loading branch information
fanquake committed May 8, 2024
2 parents 74f517b + ee67bba commit 43a66c5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/functional/feature_assumeutxo.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ def test_invalid_mempool_state(self, dump_output_path):

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,
Expand Down Expand Up @@ -239,6 +245,7 @@ def run_test(self):
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'])
Expand Down

0 comments on commit 43a66c5

Please sign in to comment.