diff --git a/ci/test/00_setup_env_native_qt5.sh b/ci/test/00_setup_env_native_qt5.sh index 7614ae933ef2..5eea2c07f7cd 100755 --- a/ci/test/00_setup_env_native_qt5.sh +++ b/ci/test/00_setup_env_native_qt5.sh @@ -14,5 +14,5 @@ export TEST_RUNNER_EXTRA="--previous-releases --coverage --extended --exclude fe export RUN_UNIT_TESTS_SEQUENTIAL="true" export RUN_UNIT_TESTS="false" export GOAL="install" -export PREVIOUS_RELEASES_TO_DOWNLOAD="v0.15.0.0 v0.16.1.1 v0.17.0.3 v18.2.2 v19.3.0 v20.0.1" +export PREVIOUS_RELEASES_TO_DOWNLOAD="v0.12.1.5 v0.15.0.0 v0.16.1.1 v0.17.0.3 v18.2.2 v19.3.0 v20.0.1" export BITCOIN_CONFIG="--enable-zmq --with-libs=no --enable-reduce-exports --disable-fuzz-binary LDFLAGS=-static-libstdc++ --with-boost-process" diff --git a/src/Makefile.am b/src/Makefile.am index 74db920908d0..5d122c0d7006 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -367,6 +367,7 @@ BITCOIN_CORE_H = \ util/overloaded.h \ util/ranges.h \ util/readwritefile.h \ + util/result.h \ util/underlying.h \ util/serfloat.h \ util/settings.h \ diff --git a/src/bench/coin_selection.cpp b/src/bench/coin_selection.cpp index a51c4b96e276..1a8f0e42d2ea 100644 --- a/src/bench/coin_selection.cpp +++ b/src/bench/coin_selection.cpp @@ -56,7 +56,7 @@ static void CoinSelection(benchmark::Bench& bench) // Create coins std::vector coins; for (const auto& wtx : wtxs) { - coins.emplace_back(COutPoint(wtx->GetHash(), 0), wtx->tx->vout.at(0), /*depth=*/6 * 24, GetTxSpendSize(wallet, *wtx, 0), /*spendable=*/true, /*solvable=*/true, /*safe=*/true, wtx->GetTxTime(), /*from_me=*/true); + coins.emplace_back(COutPoint(wtx->GetHash(), 0), wtx->tx->vout.at(0), /*depth=*/6 * 24, GetTxSpendSize(wallet, *wtx, 0), /*spendable=*/true, /*solvable=*/true, /*safe=*/true, wtx->GetTxTime(), /*from_me=*/true, /*fees=*/ 0); } const CoinEligibilityFilter filter_standard(1, 6, 0); FastRandomContext rand{}; @@ -85,7 +85,7 @@ static void add_coin(const CAmount& nValue, int nInput, std::vector CMutableTransaction tx; tx.vout.resize(nInput + 1); tx.vout[nInput].nValue = nValue; - COutput output(COutPoint(tx.GetHash(), nInput), tx.vout.at(nInput), /*depth=*/ 0, /*input_bytes=*/ -1, /*spendable=*/ true, /*solvable=*/ true, /*safe=*/ true, /*time=*/ 0, /*from_me=*/ true); + COutput output(COutPoint(tx.GetHash(), nInput), tx.vout.at(nInput), /*depth=*/ 0, /*input_bytes=*/ -1, /*spendable=*/ true, /*solvable=*/ true, /*safe=*/ true, /*time=*/ 0, /*from_me=*/ true, /*fees=*/ 0); set.emplace_back(); set.back().Insert(output, /*ancestors=*/ 0, /*descendants=*/ 0, /*positive_only=*/ false); } diff --git a/src/coinjoin/client.cpp b/src/coinjoin/client.cpp index 025823f9b9bd..6a45f576fc6c 100644 --- a/src/coinjoin/client.cpp +++ b/src/coinjoin/client.cpp @@ -1557,12 +1557,8 @@ bool CCoinJoinClientSession::CreateCollateralTransaction(CMutableTransaction& tx { AssertLockHeld(m_wallet->cs_wallet); - std::vector vCoins; - CCoinControl coin_control; - coin_control.nCoinType = CoinType::ONLY_COINJOIN_COLLATERAL; - - AvailableCoins(*m_wallet, vCoins, &coin_control); - + CCoinControl coin_control(CoinType::ONLY_COINJOIN_COLLATERAL); + std::vector vCoins{AvailableCoinsListUnspent(*m_wallet, &coin_control).coins}; if (vCoins.empty()) { strReason = strprintf("%s requires a collateral transaction and could not locate an acceptable input!", gCoinJoinName); return false; diff --git a/src/coinjoin/util.h b/src/coinjoin/util.h index c76209175d41..ab0122d1bb64 100644 --- a/src/coinjoin/util.h +++ b/src/coinjoin/util.h @@ -5,6 +5,7 @@ #ifndef BITCOIN_COINJOIN_UTIL_H #define BITCOIN_COINJOIN_UTIL_H +#include #include class CTransactionBuilder; diff --git a/src/coins.h b/src/coins.h index 94170a23901b..dedfeb74d1dc 100644 --- a/src/coins.h +++ b/src/coins.h @@ -158,7 +158,6 @@ class CCoinsViewCursor virtual bool GetKey(COutPoint &key) const = 0; virtual bool GetValue(Coin &coin) const = 0; - virtual unsigned int GetValueSize() const = 0; virtual bool Valid() const = 0; virtual void Next() = 0; diff --git a/src/dbwrapper.h b/src/dbwrapper.h index 72412cf85ae7..91f5bae74fc1 100644 --- a/src/dbwrapper.h +++ b/src/dbwrapper.h @@ -189,11 +189,6 @@ class CDBIterator } return true; } - - unsigned int GetValueSize() { - return piter->value().size(); - } - }; class CDBWrapper @@ -373,27 +368,10 @@ class CDBWrapper return size; } - /** - * Compact a certain range of keys in the database. - */ - template - void CompactRange(const K& key_begin, const K& key_end) const - { - CDataStream ssKey1(SER_DISK, CLIENT_VERSION), ssKey2(SER_DISK, CLIENT_VERSION); - ssKey1.reserve(DBWRAPPER_PREALLOC_KEY_SIZE); - ssKey2.reserve(DBWRAPPER_PREALLOC_KEY_SIZE); - ssKey1 << key_begin; - ssKey2 << key_end; - leveldb::Slice slKey1(CharCast(ssKey1.data()), ssKey1.size()); - leveldb::Slice slKey2(CharCast(ssKey2.data()), ssKey2.size()); - pdb->CompactRange(&slKey1, &slKey2); - } - void CompactFull() const { pdb->CompactRange(nullptr, nullptr); } - }; template diff --git a/src/init.cpp b/src/init.cpp index 1b0a8aa8605a..421e9adf19b8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -2037,8 +2037,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) strLoadError = _("Error initializing block database"); break; case ChainstateLoadingError::ERROR_CHAINSTATE_UPGRADE_FAILED: - strLoadError = _("Error upgrading chainstate database"); - break; + return InitError(_("Unsupported chainstate database format found. " + "Please restart with -reindex-chainstate. This will " + "rebuild the chainstate database.")); case ChainstateLoadingError::ERROR_REPLAYBLOCKS_FAILED: strLoadError = _("Unable to replay blocks. You will need to rebuild the database using -reindex-chainstate."); break; diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h index bb5058f8ea80..753b158055ae 100644 --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -128,6 +128,10 @@ class Chain //! Get locator for the current chain tip. virtual CBlockLocator getTipLocator() = 0; + //! Return a locator that refers to a block in the active chain. + //! If specified block is not in the active chain, return locator for the latest ancestor that is in the chain. + virtual CBlockLocator getActiveChainLocator(const uint256& block_hash) = 0; + //! Return height of the highest block on chain in common with the locator, //! which will either be the original block used to create the locator, //! or one of its ancestors. diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index 4732fe4a1e42..32aa6183a625 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -12,6 +12,7 @@ #include