doc: Add missing top-level description to pruneblockchain RPC #32333

pull nervana21 wants to merge 1 commits into bitcoin:master from nervana21:04-23-rpc-pruneblockchain-doc changing 1 files +3 −1
  1. nervana21 commented at 4:18 am on April 24, 2025: contributor

    Previously, the pruneblockchain RPC help output included only the method signature and arguments, with no top-level description explaining its purpose or constraints.

    This PR adds a top-level description, improving documentation consistency and alerting users to the potential impacts of using the command.

  2. DrahtBot commented at 4:18 am on April 24, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32333.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, janb84, yancyribbens, achow101

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  3. DrahtBot added the label Docs on Apr 24, 2025
  4. laanwj commented at 1:56 pm on April 24, 2025: member

    LGTM

     0pruneblockchain height
     1
     2Deletes block and undo data up to a specified height or timestamp.
     3Requires `-prune` to be enabled at startup; this action is irreversible.
     4
     5Arguments:
     61. height    (numeric, required) The block height to prune up to. May be set to a discrete height, or to a UNIX epoch time
     7             to prune blocks whose block time is at least 2 hours older than the provided timestamp.
     8
     9Result:
    10n    (numeric) Height of the last block pruned
    11
    12Examples:
    13> bitcoin-cli pruneblockchain 1000
    
  5. nervana21 force-pushed on Apr 28, 2025
  6. janb84 commented at 10:10 am on May 1, 2025: contributor

    ACK fa5ed18

    This PR adds some additional explanatory text (top level) to the pruneblockchain RPC help output. Provides more clarity what the command does and makes it more consistent with other help outputs.

    New output :

     0 % ./bitcoin-cli --regtest pruneblockchain
     1error code: -1
     2error message:
     3pruneblockchain height
     4
     5Deletes block and undo data up to a specified height or timestamp.
     6Requires `-prune` to be enabled at startup; this action is irreversible.
     7
     8Arguments:
     91. height    (numeric, required) The block height to prune up to. May be set to a discrete height, or to a UNIX epoch time
    10             to prune blocks whose block time is at least 2 hours older than the provided timestamp.
    11
    12Result:
    13n    (numeric) Height of the last block pruned
    14
    15Examples:
    16> bitcoin-cli pruneblockchain 1000
    
  7. in src/rpc/blockchain.cpp:858 in fa5ed18946 outdated
    853@@ -854,7 +854,9 @@ std::optional<int> GetPruneHeight(const BlockManager& blockman, const CChain& ch
    854 
    855 static RPCHelpMan pruneblockchain()
    856 {
    857-    return RPCHelpMan{"pruneblockchain", "",
    858+    return RPCHelpMan{"pruneblockchain",
    859+                "\nDeletes block and undo data up to a specified height or timestamp.\n"
    


    luke-jr commented at 8:36 am on May 15, 2025:
    …only if certain criteria are met?
  8. in src/rpc/blockchain.cpp:859 in fa5ed18946 outdated
    853@@ -854,7 +854,9 @@ std::optional<int> GetPruneHeight(const BlockManager& blockman, const CChain& ch
    854 
    855 static RPCHelpMan pruneblockchain()
    856 {
    857-    return RPCHelpMan{"pruneblockchain", "",
    858+    return RPCHelpMan{"pruneblockchain",
    859+                "\nDeletes block and undo data up to a specified height or timestamp.\n"
    860+                "Requires `-prune` to be enabled at startup; this action is irreversible.\n",
    


    luke-jr commented at 8:37 am on May 15, 2025:
    getblockfrompeer can reverse it AFAIK
  9. luke-jr changes_requested
  10. nervana21 force-pushed on May 15, 2025
  11. in src/rpc/blockchain.cpp:858 in c24f107efd outdated
    853@@ -854,7 +854,9 @@ std::optional<int> GetPruneHeight(const BlockManager& blockman, const CChain& ch
    854 
    855 static RPCHelpMan pruneblockchain()
    856 {
    857-    return RPCHelpMan{"pruneblockchain", "",
    858+    return RPCHelpMan{"pruneblockchain",
    859+                "\nAttempts to delete block and undo data up to a specified height or timestamp, if eligible for pruning.\n"
    


    maflcko commented at 1:10 pm on May 15, 2025:
    0                "Attempts to delete block and undo data up to a specified height or timestamp, if eligible for pruning.\n"
    

    nit: No need to start with a newline. It will be trimmed anyway.


    nervana21 commented at 1:44 pm on May 15, 2025:
    Updated, thanks!
  12. nervana21 commented at 1:17 pm on May 15, 2025: contributor

    Thanks for the feedback :)

    I’ve updated the description to clarify that pruning is conditional (not guaranteed), and that pruned data may be re-fetched in some cases (e.g., via getblockfrompeer). As such, the action is not strictly irreversible. Let me know if you’d like to see any further changes.

  13. doc: Add missing top-level description to pruneblockchain RPC
    Previously, the `pruneblockchain` RPC help output included only the method signature and arguments, with no top-level description explaining its purpose or constraints.
    
    This PR adds a concise top-level description, improving documentation consistency and alerting users to the potential impacts of using the command.
    135a0f0aa7
  14. nervana21 force-pushed on May 15, 2025
  15. maflcko commented at 1:47 pm on May 15, 2025: member
    lgtm ACK 135a0f0aa711b95c50aa4cbe0c38d82d647f1c8b
  16. DrahtBot requested review from janb84 on May 15, 2025
  17. janb84 commented at 5:44 pm on May 15, 2025: contributor

    re ACK 135a0f0

    Changes since last ACK:

    • Textual improvements of description to be more precise.
    • Removal of leading new line (/n)
  18. yancyribbens commented at 5:14 pm on May 17, 2025: contributor
  19. achow101 commented at 6:51 pm on May 20, 2025: member
    ACK 135a0f0aa711b95c50aa4cbe0c38d82d647f1c8b
  20. achow101 merged this on May 20, 2025
  21. achow101 closed this on May 20, 2025

  22. nervana21 deleted the branch on May 21, 2025

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: 2025-05-30 03:12 UTC

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