From 697f03a17e714ebca15f732bae83b0f2e4f0c05a Mon Sep 17 00:00:00 2001 From: Tom Trevethan Date: Mon, 20 Apr 2026 11:30:09 +0100 Subject: [PATCH] fix needing to reindex chainstate after pegin --- src/txdb.cpp | 3 ++- test/functional/feature_pegin_subsidy.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/txdb.cpp b/src/txdb.cpp index 3d362d10ff..cd6a20712e 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -37,7 +37,8 @@ bool CCoinsViewDB::NeedsUpgrade() // DB_COINS was deprecated in v0.15.0, commit // 1088b02f0ccd7358d2b7076bb9e122d59d502d02 cursor->Seek(std::make_pair(DB_COINS, uint256{})); - return cursor->Valid(); + std::pair key; + return cursor->Valid() && cursor->GetKey(key) && key.first == DB_COINS; } namespace { diff --git a/test/functional/feature_pegin_subsidy.py b/test/functional/feature_pegin_subsidy.py index 2443a4e607..49e8758e7a 100755 --- a/test/functional/feature_pegin_subsidy.py +++ b/test/functional/feature_pegin_subsidy.py @@ -866,7 +866,7 @@ class PeginSubsidyTest(BitcoinTestFramework): # dust error # restart node1 with no min peg-in amount self.stop_node(1, expected_stderr=self.expected_stderr) # when running with bitcoind as parent node this stderr can occur - self.start_node(1, extra_args=sidechain.extra_args + ["-peginminamount=0", "-reindex-chainstate"]) # ELEMENTS FIXME: figure out why we need to reindex chanstate for this restart + self.start_node(1, extra_args=sidechain.extra_args + ["-peginminamount=0"]) self.log.info("claimpegin dust error") amount = Decimal("0.00000546") if self.options.parent_bitcoin else Decimal("0.00000645") txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount)