Skip to content

Commit

Permalink
message reindex-chainstate is prohibited on pruned nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominion5254 committed Jun 20, 2024
1 parent 0a48b1a commit 55a81ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions actions/reindex_chainstate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

set -e

touch /root/.bitcoin/requires.reindex_chainstate
action_result_running=" {
\"version\": \"0\",
\"message\": \"Bitcoin Core restarting in reindex chainstate mode\",
Expand All @@ -17,4 +16,19 @@ action_result_stopped=" {
\"copyable\": false,
\"qr\": false
}"
bitcoin-cli -rpcconnect=bitcoind.embassy stop >/dev/null 2>/dev/null && echo $action_result_running || echo $action_result_stopped
action_result_pruned=" {
\"version\": \"0\",
\"message\": \"Bitcoin Core does not allow reindex-chainstate for pruned nodes. If the Chainstate is corrupted on a pruned node, the entire blockchain will need to be re-downloaded from genesis with the 'Reindex Blockchain' action\",
\"value\": null,
\"copyable\": false,
\"qr\": false
}"

pruned=$(yq e '.advanced.pruning.mode' /root/.bitcoin/start9/config.yaml)

if [ "$pruned" != "disabled" ]; then
echo $action_result_pruned
else
touch /root/.bitcoin/requires.reindex_chainstate
bitcoin-cli -rpcconnect=bitcoind.embassy stop >/dev/null 2>/dev/null && echo $action_result_running || echo $action_result_stopped
fi
2 changes: 1 addition & 1 deletion manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ actions:
reindex-chainstate:
name: "Reindex Chainstate"
description: "Rebuilds the chainstate database using existing block index data; as the block index is not rebuilt, 'reindex_chainstate' should be strictly faster than 'reindex'. This action should only be used in the case of chainstate corruption; if the blocks stored on disk are corrupted, the 'reindex' action will need to be run instead."
warning: Blocks not stored on disk will be redownloaded in order to rebuild the database. If your node is pruned, this action is equivalent to syncing the node from scratch, so this process could take weeks on low-end hardware.
warning: Pruned nodes do not allow 'reindex-chainstate'; if you are running a pruned node and suspect chainstate corruption the 'reindex' action (requiring redownloading the entire Blockchain) should be run instead.
allowed-statuses:
- running
- stopped
Expand Down

0 comments on commit 55a81ed

Please sign in to comment.