test: check that pruneblockchain RPC fails for future block or timestamp #23796

pull theStack wants to merge 1 commits into bitcoin:master from theStack:202112-test-add_pruneblockchain_test_coverage changing 1 files +9 −2
  1. theStack commented at 4:00 PM on December 16, 2021: member

    This PR adds missing test coverage for the pruneblockchain RPC for the case that a future block or timestamp is passed: https://github.com/bitcoin/bitcoin/blob/8c0bd871fcf6c5ff5851ccb18a7bc7554a0484b0/src/rpc/blockchain.cpp#L1101 https://github.com/bitcoin/bitcoin/blob/8c0bd871fcf6c5ff5851ccb18a7bc7554a0484b0/src/rpc/blockchain.cpp#L1111 Note that the test method manual_test gets called twice, once each with use_timestamp set to True/False, respectively. Depending on that, the helper function height either converts the passed block height to the timestamp of that block, or just returns it without modification.

    The other tests for failures in this RPC are also changed to be more detailled ("Cannot prune blocks because node is not in prune mode", "Negative block height"), as I don't think there is any value in just checking a sub-string. If there is ever an error with the same sub-string is introduced, it's not clear which error is exactly checked with the test, so it makes sense to be as specific as possible.

  2. test: check that pruneblockchain RPC fails for future block or timestamp 140a49ce5e
  3. fanquake added the label Tests on Dec 16, 2021
  4. brunoerg approved
  5. brunoerg commented at 12:29 PM on December 20, 2021: member

    tACK 140a49ce5e547a1b520a7cd063af8308184e7cbf

  6. MarcoFalke merged this on Dec 20, 2021
  7. MarcoFalke closed this on Dec 20, 2021

  8. theStack deleted the branch on Dec 20, 2021
  9. sidhujag referenced this in commit 91b28060a3 on Dec 20, 2021
  10. PastaPastaPasta referenced this in commit bf3ed4ca17 on Apr 7, 2022
  11. PastaPastaPasta referenced this in commit 92401e38af on Apr 7, 2022
  12. PastaPastaPasta referenced this in commit a2395e8286 on Apr 7, 2022
  13. PastaPastaPasta referenced this in commit b8ae487139 on Apr 11, 2022
  14. DrahtBot locked this on Dec 20, 2022
Contributors
Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 21:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me