aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlaanwj <126646+laanwj@users.noreply.github.com>2022-04-05 15:28:01 +0200
committerlaanwj <126646+laanwj@users.noreply.github.com>2022-04-05 15:38:14 +0200
commitf421de5be611f874a027392d5fee7e113dce4f54 (patch)
tree8ee142442db936bf40f29532f691e6e9f98f623d /test
parentee9af95f095474641400469a2940e0fd4a052ca3 (diff)
parentfa9112aac07dc371bfda437d40eb1b841f36f392 (diff)
downloadbitcoin-f421de5be611f874a027392d5fee7e113dce4f54.tar.xz
Merge bitcoin/bitcoin#24236: Remove utxo db upgrade code
fa9112aac07dc371bfda437d40eb1b841f36f392 Remove utxo db upgrade code (MarcoFalke) Pull request description: It is not possible to upgrade Bitcoin Core pre-segwit (pre-0.13.1) to a recent version without a full IBD from scratch after commit 19a56d1519fb493c3e1bd5cad55360b6b80fa52b (released in version 22.0). Any Bitcoin Core version with the new database format after commit 1088b02f0ccd7358d2b7076bb9e122d59d502d02 (released in version 0.15), can upgrade to any version that is supported as of today. This leaves the versions 0.13.1-0.14.x. Even though those versions are unsupported, some users with an existing datadir may want to upgrade to a recent version. However, it seems reasonable to simply ask them to `-reindex` to run a full IBD from scratch. This allows us to remove the utxo db upgrade code. ACKs for top commit: Sjors: re-ACK fa9112aac07dc371bfda437d40eb1b841f36f392 laanwj: Code review ACK fa9112aac07dc371bfda437d40eb1b841f36f392 Tree-SHA512: 4243bb35df9ac4892f9fad30fe486d338745952bcff4160bcb0937c772d57b13b800647da14695e21e3655e85ee0d95fa3dc7789ee309d59ad84f422297fecb8
Diffstat (limited to 'test')
-rw-r--r--test/README.md2
-rwxr-xr-xtest/functional/feature_unsupported_utxo_db.py61
-rwxr-xr-xtest/functional/test_runner.py1
-rwxr-xr-xtest/get_previous_releases.py6
4 files changed, 68 insertions, 2 deletions
diff --git a/test/README.md b/test/README.md
index 87a3acb768..84264277f7 100644
--- a/test/README.md
+++ b/test/README.md
@@ -98,7 +98,7 @@ test/functional/test_runner.py --extended
In order to run backwards compatibility tests, download the previous node binaries:
```
-test/get_previous_releases.py -b v22.0 v0.21.0 v0.20.1 v0.19.1 v0.18.1 v0.17.2 v0.16.3 v0.15.2
+test/get_previous_releases.py -b v22.0 v0.21.0 v0.20.1 v0.19.1 v0.18.1 v0.17.2 v0.16.3 v0.15.2 v0.14.3
```
By default, up to 4 tests will be run in parallel by test_runner. To specify
diff --git a/test/functional/feature_unsupported_utxo_db.py b/test/functional/feature_unsupported_utxo_db.py
new file mode 100755
index 0000000000..1c8c08d1d8
--- /dev/null
+++ b/test/functional/feature_unsupported_utxo_db.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python3
+# Copyright (c) 2022 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 that unsupported utxo db causes an init error.
+
+Previous releases are required by this test, see test/README.md.
+"""
+
+import shutil
+
+from test_framework.test_framework import BitcoinTestFramework
+from test_framework.util import assert_equal
+
+
+class UnsupportedUtxoDbTest(BitcoinTestFramework):
+ def set_test_params(self):
+ self.setup_clean_chain = True
+ self.num_nodes = 2
+
+ def skip_test_if_missing_module(self):
+ self.skip_if_no_previous_releases()
+
+ def setup_network(self):
+ self.add_nodes(
+ self.num_nodes,
+ versions=[
+ 140300, # Last release with previous utxo db format
+ None, # For MiniWallet, without migration code
+ ],
+ )
+
+ def run_test(self):
+ self.log.info("Create previous version (v0.14.3) utxo db")
+ self.start_node(0)
+ block = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[-1]
+ assert_equal(self.nodes[0].getbestblockhash(), block)
+ assert_equal(self.nodes[0].gettxoutsetinfo()["total_amount"], 50)
+ self.stop_nodes()
+
+ self.log.info("Check init error")
+ legacy_utxos_dir = self.nodes[0].chain_path / "chainstate"
+ legacy_blocks_dir = self.nodes[0].chain_path / "blocks"
+ recent_utxos_dir = self.nodes[1].chain_path / "chainstate"
+ recent_blocks_dir = self.nodes[1].chain_path / "blocks"
+ shutil.copytree(legacy_utxos_dir, recent_utxos_dir)
+ shutil.copytree(legacy_blocks_dir, recent_blocks_dir)
+ self.nodes[1].assert_start_raises_init_error(
+ expected_msg="Error: Unsupported chainstate database format found. "
+ "Please restart with -reindex-chainstate. "
+ "This will rebuild the chainstate database.",
+ )
+
+ self.log.info("Drop legacy utxo db")
+ self.start_node(1, extra_args=["-reindex-chainstate"])
+ assert_equal(self.nodes[1].getbestblockhash(), block)
+ assert_equal(self.nodes[1].gettxoutsetinfo()["total_amount"], 50)
+
+
+if __name__ == "__main__":
+ UnsupportedUtxoDbTest().main()
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py
index 39f4edb1ce..381d2b9426 100755
--- a/test/functional/test_runner.py
+++ b/test/functional/test_runner.py
@@ -306,6 +306,7 @@ BASE_SCRIPTS = [
'p2p_ping.py',
'rpc_scantxoutset.py',
'feature_txindex_compatibility.py',
+ 'feature_unsupported_utxo_db.py',
'feature_logging.py',
'feature_anchors.py',
'feature_coinstatsindex.py',
diff --git a/test/get_previous_releases.py b/test/get_previous_releases.py
index e0d48f8047..688ca58d7f 100755
--- a/test/get_previous_releases.py
+++ b/test/get_previous_releases.py
@@ -19,8 +19,12 @@ import subprocess
import sys
import hashlib
-
SHA256_SUMS = {
+ "0e2819135366f150d9906e294b61dff58fd1996ebd26c2f8e979d6c0b7a79580": "bitcoin-0.14.3-aarch64-linux-gnu.tar.gz",
+ "d86fc90824a85c38b25c8488115178d5785dbc975f5ff674f9f5716bc8ad6e65": "bitcoin-0.14.3-arm-linux-gnueabihf.tar.gz",
+ "1b0a7408c050e3d09a8be8e21e183ef7ee570385dc41216698cc3ab392a484e7": "bitcoin-0.14.3-osx64.tar.gz",
+ "706e0472dbc933ed2757650d54cbcd780fd3829ebf8f609b32780c7eedebdbc9": "bitcoin-0.14.3-x86_64-linux-gnu.tar.gz",
+ #
"d40f18b4e43c6e6370ef7db9131f584fbb137276ec2e3dba67a4b267f81cb644": "bitcoin-0.15.2-aarch64-linux-gnu.tar.gz",
"54fb877a148a6ad189a1e1ab1ff8b11181e58ff2aaf430da55b3fd46ae549a6b": "bitcoin-0.15.2-arm-linux-gnueabihf.tar.gz",
"87e9340ff3d382d543b2b69112376077f0c8b4f7450d372e83b68f5a1e22b2df": "bitcoin-0.15.2-osx64.tar.gz",