Page MenuHomePhabricator

script: Enhance validations in utxo_snapshot.sh
ClosedPublic

Authored by PiRK on Tue, Mar 25, 15:03.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCdebc1be254f1: script: Enhance validations in utxo_snapshot.sh
Summary
  • Ensure that the snapshot height is higher than the pruned block height when the node is pruned.
  • Validate the correctness of the file path and check if the file already exists.
  • Make network activity disablement optional for the user.
  • Ensure the reconsiderblock command is triggered on exit, even in the case of user interruption (Ctrl-C).
  • Fix block height out of range
  • Fix hash_serialized_2 -> hash_serialized

This is a backport of core#28852, core#30690

Test Plan

Backup the datadir.
Start bitcoind in a different terminal and monitor it while the script is running.

$ ./contrib/devtools/utxo_snapshot.sh 888000 ../utxo.dat ./build/src/bitcoin-cli
Do you want to disable network activity (setnetworkactive false) before running invalidateblock? (Y/n): Y
Disabling network activity
false
Rewinding chain back to height 888000 (by invalidating 00000000000000001e72f6310cc606c4a47d71d5168f55b6f96b6a6f61f9f616); this may take a while
Generating UTXO snapshot...
{
  "coins_written": 38780572,
  "base_hash": "00000000000000002b218d995a292c34bc4c0244bb4bbdad18f3a97e88ccb567",
  "base_height": 888000,
  "path": "/data0/ecashd/../utxo.dat",
  "txoutset_hash": "50493f6218661a189654dbad816821a656b519454190c63daf376610e4fa0a7e",
  "nchaintx": 299158458
}
Restoring chain to original height; this may take a while
Restoring network activity
true

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable