From fa685715663117955e9bb795cbf79ddbd3dfed19 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Fri, 13 Oct 2023 12:23:25 +0200 Subject: [PATCH] test: Add assumeutxo test for wrong hash --- test/functional/feature_assumeutxo.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/test/functional/feature_assumeutxo.py b/test/functional/feature_assumeutxo.py index 376e35da3b..fef2e9d02c 100755 --- a/test/functional/feature_assumeutxo.py +++ b/test/functional/feature_assumeutxo.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright (c) 2021 The Bitcoin Core developers +# Copyright (c) 2021-present 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 for assumeutxo, a means of quickly bootstrapping a node using @@ -17,8 +17,7 @@ The assumeutxo value generated and used here is committed to in Interesting test cases could be loading an assumeutxo snapshot file with: -- TODO: An invalid hash -- TODO: Valid hash but invalid snapshot file (bad coin height or truncated file or +- TODO: Valid hash but invalid snapshot file (bad coin height or bad other serialization) - TODO: Valid snapshot file, but referencing an unknown block - TODO: Valid snapshot file, but referencing a snapshot block that turns out to be @@ -40,7 +39,6 @@ from test_framework.util import ( assert_equal, assert_raises_rpc_error, ) -import struct START_HEIGHT = 199 SNAPSHOT_BASE_HEIGHT = 299 @@ -81,17 +79,25 @@ class AssumeutxoTest(BitcoinTestFramework): assert_raises_rpc_error(-32603, f"Unable to load UTXO snapshot, {error_details}", self.nodes[1].loadtxoutset, bad_snapshot_path) self.log.info(" - snapshot file with wrong number of coins") - valid_num_coins = struct.unpack("