mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
e3a97b0156
## Issue being fixed or feature implemented This changes are follow up for backport bitcoin/bitcoin#16060 ## What was done? Buried all hardened dash deployments ## How Has This Been Tested? Run unit/functional tests. Run dash with option `-reindex` for both mainnet/testnet - both succeed. ## Breaking Changes No breaking changes, it should be fully compatible. ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone
52 lines
1.9 KiB
Python
Executable File
52 lines
1.9 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2019 The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
"""Test the generation of UTXO snapshots using `dumptxoutset`.
|
|
"""
|
|
from test_framework.test_framework import BitcoinTestFramework
|
|
from test_framework.util import assert_equal, assert_raises_rpc_error
|
|
|
|
import hashlib
|
|
from pathlib import Path
|
|
|
|
|
|
class DumptxoutsetTest(BitcoinTestFramework):
|
|
def set_test_params(self):
|
|
self.setup_clean_chain = True
|
|
self.num_nodes = 1
|
|
|
|
def run_test(self):
|
|
"""Test a trivial usage of the dumptxoutset RPC command."""
|
|
node = self.nodes[0]
|
|
mocktime = node.getblockheader(node.getblockhash(0))['time'] + 1
|
|
node.setmocktime(mocktime)
|
|
node.generate(100)
|
|
|
|
FILENAME = 'txoutset.dat'
|
|
out = node.dumptxoutset(FILENAME)
|
|
expected_path = Path(node.datadir) / self.chain / FILENAME
|
|
|
|
assert expected_path.is_file()
|
|
|
|
assert_equal(out['coins_written'], 100)
|
|
assert_equal(out['base_height'], 100)
|
|
assert_equal(out['path'], str(expected_path))
|
|
# Blockhash should be deterministic based on mocked time.
|
|
assert_equal(
|
|
out['base_hash'],
|
|
'0266fa3cd96867c40f2f3056da3b66daf8fb4c83ec4f3f5344fd3fe9755794b5')
|
|
|
|
with open(str(expected_path), 'rb') as f:
|
|
digest = hashlib.sha256(f.read()).hexdigest()
|
|
# UTXO snapshot hash should be deterministic based on mocked time.
|
|
assert_equal(
|
|
digest, '83ec62f0b9d9f2cdfe4514e8996d5ba0a6aa4cf74517988670d912db83bc0318')
|
|
|
|
# Specifying a path to an existing file will fail.
|
|
assert_raises_rpc_error(
|
|
-8, '{} already exists'.format(FILENAME), node.dumptxoutset, FILENAME)
|
|
|
|
if __name__ == '__main__':
|
|
DumptxoutsetTest().main()
|