Merge #6272: trivial: remove some legacy code, make global a unique_ptr, simplify get_next_work test, make UBSan CI halt on error (misc. changes)

4e621037c5 test: move `EXPECTED_STDERR_NO_GOV`{`_PRUNE`} and use it more (Kittywhiskers Van Gogh)
77ce6af5c1 chore: remove ancient setting migration logic (Kittywhiskers Van Gogh)
061aa05cf0 chore: remove old llmq db migration code (Kittywhiskers Van Gogh)
438cb85ece ci: set UBSan to halt on error and provide more information (Kittywhiskers Van Gogh)
3a1743fc7f trivial: avoid unneeded copy when iterating through `mapDenomCount` (Kittywhiskers Van Gogh)
cba650953a test: simplify `pow_test`'s `get_next_work` block index construction (Kittywhiskers Van Gogh)
dacf859218 refactor: make `pdsNotificationInterface` a `unique_ptr`, rename (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  Collection of miscellaneous changes collected from work on earlier pull requests that don't fit into pull requests in the immediate future but are nonetheless useful.

  ## Checklist

  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)**
  - [x] I have added or updated relevant unit/integration/functional/e2e tests
  - [x] I have made corresponding changes to the documentation **(note: N/A)**
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  knst:
    re-utACK 4e621037c5
  UdjinM6:
    utACK 4e621037c5

Tree-SHA512: 5af4e5afdc34840905ffbf375f53cb12b682053cc135ff190dd02d245da9903a7f3e6af6fb1f1727546bf5034cbe42243477342f775e05d15bcfc5d5957616e9
This commit is contained in:
pasta 2024-09-24 08:50:54 -05:00
commit 60a7902b43
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
15 changed files with 66 additions and 136 deletions

View File

@ -14,7 +14,7 @@ source ./ci/test/00_setup_env.sh
export ASAN_OPTIONS=""
export LSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/lsan"
export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:halt_on_error=1"
export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan"
export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1"
if [ "$BUILD_TARGET" = "arm-linux" ]; then
source ./ci/test/00_setup_env_arm.sh

View File

@ -1727,7 +1727,7 @@ bool CCoinJoinClientSession::CreateDenominated(CAmount nBalanceToDenominate, con
}
bool finished = true;
for (const auto [denom, count] : mapDenomCount) {
for (const auto& [denom, count] : mapDenomCount) {
// Check if this specific denom could use another loop, check that there aren't nCoinJoinDenomsGoal of this
// denom and that our nValueLeft/nBalanceToDenominate is enough to create one of these denoms, if so, loop again.
if (count < CCoinJoinClientOptions::GetDenomsGoal() && txBuilder.CouldAddOutput(denom) && nBalanceToDenominate > 0) {
@ -1807,7 +1807,7 @@ bool CCoinJoinClientSession::CreateDenominated(CAmount nBalanceToDenominate, con
WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::%s -- 3 - nBalanceToDenominate: %f, %s\n", __func__, (float) nBalanceToDenominate / COIN, txBuilder.ToString());
for (const auto [denom, count] : mapDenomCount) {
for (const auto& [denom, count] : mapDenomCount) {
WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::%s -- 3 - DONE - nDenomValue: %f, count: %d\n", __func__, (float) denom / COIN, count);
}

View File

@ -153,3 +153,5 @@ void CDSNotificationInterface::NotifyChainLock(const CBlockIndex* pindex, const
m_llmq_ctx->isman->NotifyChainLock(pindex);
m_cj_ctx->dstxman->NotifyChainLock(pindex, *m_llmq_ctx->clhandler, m_mn_sync);
}
std::unique_ptr<CDSNotificationInterface> g_ds_notification_interface;

View File

@ -60,4 +60,6 @@ private:
const std::unique_ptr<CJContext>& m_cj_ctx;
};
extern std::unique_ptr<CDSNotificationInterface> g_ds_notification_interface;
#endif // BITCOIN_DSNOTIFICATIONINTERFACE_H

View File

@ -141,8 +141,6 @@ static constexpr bool DEFAULT_PROXYRANDOMIZE{true};
static constexpr bool DEFAULT_REST_ENABLE{false};
static constexpr bool DEFAULT_I2P_ACCEPT_INCOMING{true};
static CDSNotificationInterface* pdsNotificationInterface = nullptr;
#ifdef WIN32
// Win32 LevelDB doesn't use filedescriptors, and the ones used for
// accessing block files don't count towards the fd_set size limit
@ -369,11 +367,11 @@ void PrepareShutdown(NodeContext& node)
}
#endif
if (pdsNotificationInterface) {
UnregisterValidationInterface(pdsNotificationInterface);
delete pdsNotificationInterface;
pdsNotificationInterface = nullptr;
if (g_ds_notification_interface) {
UnregisterValidationInterface(g_ds_notification_interface.get());
g_ds_notification_interface.reset();
}
if (node.mn_activeman) {
UnregisterValidationInterface(node.mn_activeman.get());
node.mn_activeman.reset();
@ -2147,10 +2145,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
node.cj_ctx, node.llmq_ctx, ignores_incoming_txs);
RegisterValidationInterface(node.peerman.get());
pdsNotificationInterface = new CDSNotificationInterface(
g_ds_notification_interface = std::make_unique<CDSNotificationInterface>(
*node.connman, *node.mn_sync, *node.govman, *node.peerman, chainman, node.mn_activeman.get(), node.dmnman, node.llmq_ctx, node.cj_ctx
);
RegisterValidationInterface(pdsNotificationInterface);
RegisterValidationInterface(g_ds_notification_interface.get());
// ********************************************************* Step 7c: Setup CoinJoin
@ -2327,7 +2325,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
}
chainman.m_load_block = std::thread(&util::TraceThread, "loadblk", [=, &args, &chainman, &node] {
ThreadImport(chainman, *node.dmnman, *pdsNotificationInterface, vImportFiles, node.mn_activeman.get(), args);
ThreadImport(chainman, *node.dmnman, *g_ds_notification_interface, vImportFiles, node.mn_activeman.get(), args);
});
// Wait for genesis block to be processed

View File

@ -47,9 +47,6 @@ LLMQContext::LLMQContext(CChainState& chainstate, CConnman& connman, CDeterminis
ehfSignalsHandler{std::make_unique<llmq::CEHFSignalsHandler>(chainstate, mnhfman, *sigman, *shareman, mempool,
*qman, sporkman, peerman)}
{
// NOTE: we use this only to wipe the old db, do NOT use it for anything else
// TODO: remove it in some future version
auto llmqDbTmp = std::make_unique<CDBWrapper>(unit_tests ? "" : (gArgs.GetDataDirNet() / "llmq"), 1 << 20, unit_tests, true);
}
LLMQContext::~LLMQContext() {

View File

@ -232,13 +232,8 @@ void OptionsModel::Init(bool resetSettings)
if (!gArgs.SoftSetArg("-coinjoinrounds", settings.value("nCoinJoinRounds").toString().toStdString()))
addOverriddenOption("-coinjoinrounds");
if (!settings.contains("nCoinJoinAmount")) {
// for migration from old settings
if (!settings.contains("nAnonymizeDashAmount"))
settings.setValue("nCoinJoinAmount", DEFAULT_COINJOIN_AMOUNT);
else
settings.setValue("nCoinJoinAmount", settings.value("nAnonymizeDashAmount").toInt());
}
if (!settings.contains("nCoinJoinAmount"))
settings.setValue("nCoinJoinAmount", DEFAULT_COINJOIN_AMOUNT);
if (!gArgs.SoftSetArg("-coinjoinamount", settings.value("nCoinJoinAmount").toString().toStdString()))
addOverriddenOption("-coinjoinamount");

View File

@ -16,107 +16,34 @@ BOOST_AUTO_TEST_CASE(get_next_work)
{
const auto chainParams = CreateChainParams(*m_node.args, CBaseChainParams::MAIN);
// build the chain of 24 blocks
CBlockIndex blockIndexLast;
blockIndexLast.nHeight = 123456;
blockIndexLast.nTime = 1408732489;
blockIndexLast.nBits = 0x1b1418d4;
CBlockIndex blockIndexPrev1 = CBlockIndex();
blockIndexPrev1.nTime = 1408732257; // Block #123455
blockIndexPrev1.nBits = 0x1b13b83f;
blockIndexLast.pprev = &blockIndexPrev1;
CBlockIndex blockIndexPrev2 = CBlockIndex();
blockIndexPrev2.nTime = 1408732229; // Block #123454
blockIndexPrev2.nBits = 0x1b10460b;
blockIndexPrev1.pprev = &blockIndexPrev2;
CBlockIndex blockIndexPrev3 = CBlockIndex();
blockIndexPrev3.nTime = 1408731256; // Block #123453
blockIndexPrev3.nBits = 0x1b113ff1;
blockIndexPrev2.pprev = &blockIndexPrev3;
CBlockIndex blockIndexPrev4 = CBlockIndex();
blockIndexPrev4.nTime = 1408731242; // Block #123452
blockIndexPrev4.nBits = 0x1b0fed89;
blockIndexPrev3.pprev = &blockIndexPrev4;
CBlockIndex blockIndexPrev5 = CBlockIndex();
blockIndexPrev5.nTime = 1408730914; // Block #123451
blockIndexPrev5.nBits = 0x1b10b864;
blockIndexPrev4.pprev = &blockIndexPrev5;
CBlockIndex blockIndexPrev6 = CBlockIndex();
blockIndexPrev6.nTime = 1408730862; // Block #123450
blockIndexPrev6.nBits = 0x1b0dd168;
blockIndexPrev5.pprev = &blockIndexPrev6;
CBlockIndex blockIndexPrev7 = CBlockIndex();
blockIndexPrev7.nTime = 1408730179; // Block #123449
blockIndexPrev7.nBits = 0x1b0c03d6;
blockIndexPrev6.pprev = &blockIndexPrev7;
CBlockIndex blockIndexPrev8 = CBlockIndex();
blockIndexPrev8.nTime = 1408729678; // Block #123448
blockIndexPrev8.nBits = 0x1b0c9ab8;
blockIndexPrev7.pprev = &blockIndexPrev8;
CBlockIndex blockIndexPrev9 = CBlockIndex();
blockIndexPrev9.nTime = 1408729647; // Block #123447
blockIndexPrev9.nBits = 0x1b0dfaff;
blockIndexPrev8.pprev = &blockIndexPrev9;
CBlockIndex blockIndexPrev10 = CBlockIndex();
blockIndexPrev10.nTime = 1408729587; // Block #123446
blockIndexPrev10.nBits = 0x1b10e878;
blockIndexPrev9.pprev = &blockIndexPrev10;
CBlockIndex blockIndexPrev11 = CBlockIndex();
blockIndexPrev11.nTime = 1408729576; // Block #123445
blockIndexPrev11.nBits = 0x1b1063d0;
blockIndexPrev10.pprev = &blockIndexPrev11;
CBlockIndex blockIndexPrev12 = CBlockIndex();
blockIndexPrev12.nTime = 1408729474; // Block #123444
blockIndexPrev12.nBits = 0x1b104297;
blockIndexPrev11.pprev = &blockIndexPrev12;
CBlockIndex blockIndexPrev13 = CBlockIndex();
blockIndexPrev13.nTime = 1408729305; // Block #123443
blockIndexPrev13.nBits = 0x1b107556;
blockIndexPrev12.pprev = &blockIndexPrev13;
CBlockIndex blockIndexPrev14 = CBlockIndex();
blockIndexPrev14.nTime = 1408729179; // Block #123442
blockIndexPrev14.nBits = 0x1b110764;
blockIndexPrev13.pprev = &blockIndexPrev14;
CBlockIndex blockIndexPrev15 = CBlockIndex();
blockIndexPrev15.nTime = 1408729116; // Block #123441
blockIndexPrev15.nBits = 0x1b1141bf;
blockIndexPrev14.pprev = &blockIndexPrev15;
CBlockIndex blockIndexPrev16 = CBlockIndex();
blockIndexPrev16.nTime = 1408728950; // Block #123440
blockIndexPrev16.nBits = 0x1b1123f9;
blockIndexPrev15.pprev = &blockIndexPrev16;
CBlockIndex blockIndexPrev17 = CBlockIndex();
blockIndexPrev17.nTime = 1408728756; // Block #123439
blockIndexPrev17.nBits = 0x1b118d9c;
blockIndexPrev16.pprev = &blockIndexPrev17;
CBlockIndex blockIndexPrev18 = CBlockIndex();
blockIndexPrev18.nTime = 1408728744; // Block #123438
blockIndexPrev18.nBits = 0x1b11abac;
blockIndexPrev17.pprev = &blockIndexPrev18;
CBlockIndex blockIndexPrev19 = CBlockIndex();
blockIndexPrev19.nTime = 1408728608; // Block #123437
blockIndexPrev19.nBits = 0x1b11951e;
blockIndexPrev18.pprev = &blockIndexPrev19;
CBlockIndex blockIndexPrev20 = CBlockIndex();
blockIndexPrev20.nTime = 1408728495; // Block #123436
blockIndexPrev20.nBits = 0x1b121cf3;
blockIndexPrev19.pprev = &blockIndexPrev20;
CBlockIndex blockIndexPrev21 = CBlockIndex();
blockIndexPrev21.nTime = 1408728479; // Block #123435
blockIndexPrev21.nBits = 0x1b11a33c;
blockIndexPrev20.pprev = &blockIndexPrev21;
CBlockIndex blockIndexPrev22 = CBlockIndex();
blockIndexPrev22.nTime = 1408728332; // Block #123434
blockIndexPrev22.nBits = 0x1b10e09e;
blockIndexPrev21.pprev = &blockIndexPrev22;
CBlockIndex blockIndexPrev23 = CBlockIndex();
blockIndexPrev23.nTime = 1408728124; // Block #123433
blockIndexPrev23.nBits = 0x1b104be1;
blockIndexPrev22.pprev = &blockIndexPrev23;
static const std::vector<std::pair<uint32_t, uint32_t>> mainnet_data = {
{ 1408728124, 0x1b104be1U }, { 1408728332, 0x1b10e09eU }, { 1408728479, 0x1b11a33cU },
{ 1408728495, 0x1b121cf3U }, { 1408728608, 0x1b11951eU }, { 1408728744, 0x1b11abacU },
{ 1408728756, 0x1b118d9cU }, { 1408728950, 0x1b1123f9U }, { 1408729116, 0x1b1141bfU },
{ 1408729179, 0x1b110764U }, { 1408729305, 0x1b107556U }, { 1408729474, 0x1b104297U },
{ 1408729576, 0x1b1063d0U }, { 1408729587, 0x1b10e878U }, { 1408729647, 0x1b0dfaffU },
{ 1408729678, 0x1b0c9ab8U }, { 1408730179, 0x1b0c03d6U }, { 1408730862, 0x1b0dd168U },
{ 1408730914, 0x1b10b864U }, { 1408731242, 0x1b0fed89U }, { 1408731256, 0x1b113ff1U },
{ 1408732229, 0x1b10460bU }, { 1408732257, 0x1b13b83fU }, { 1408732489, 0x1b1418d4U }
};
// Construct a chain of block index entries
std::list<CBlockIndex> blockidx;
CBlockIndex* blockIndexLast{nullptr};
for (const auto& [nTime, nBits] : mainnet_data) {
auto& entry = blockidx.emplace_back();
entry.nTime = nTime;
entry.nBits = nBits;
entry.pprev = blockIndexLast;
blockIndexLast = &entry;
}
blockIndexLast->nHeight = 123456;
assert(mainnet_data.size() == blockidx.size());
CBlockHeader blockHeader;
blockHeader.nTime = 1408732505; // Block #123457
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, chainParams->GetConsensus()), 0x1b1441deU); // Block #123457 has 0x1b1441de
BOOST_CHECK_EQUAL(GetNextWorkRequired(blockIndexLast, &blockHeader, chainParams->GetConsensus()), 0x1b1441deU); // Block #123457 has 0x1b1441de
// test special rules for slow blocks on devnet/testnet
gArgs.SoftSetBoolArg("-devnet", true);
@ -125,18 +52,18 @@ BOOST_AUTO_TEST_CASE(get_next_work)
// make sure normal rules apply
blockHeader.nTime = 1408732505; // Block #123457
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x1b1441deU); // Block #123457 has 0x1b1441de
BOOST_CHECK_EQUAL(GetNextWorkRequired(blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x1b1441deU); // Block #123457 has 0x1b1441de
// 10x higher target
blockHeader.nTime = 1408733090; // Block #123457 (10m+1sec)
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x1c00c8f8U); // Block #123457 has 0x1c00c8f8
BOOST_CHECK_EQUAL(GetNextWorkRequired(blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x1c00c8f8U); // Block #123457 has 0x1c00c8f8
blockHeader.nTime = 1408733689; // Block #123457 (20m)
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x1c00c8f8U); // Block #123457 has 0x1c00c8f8
BOOST_CHECK_EQUAL(GetNextWorkRequired(blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x1c00c8f8U); // Block #123457 has 0x1c00c8f8
// lowest diff possible
blockHeader.nTime = 1408739690; // Block #123457 (2h+1sec)
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x207fffffU); // Block #123457 has 0x207fffff
BOOST_CHECK_EQUAL(GetNextWorkRequired(blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x207fffffU); // Block #123457 has 0x207fffff
blockHeader.nTime = 1408743289; // Block #123457 (3h)
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x207fffffU); // Block #123457 has 0x207fffff
BOOST_CHECK_EQUAL(GetNextWorkRequired(blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x207fffffU); // Block #123457 has 0x207fffff
}
/* Test the constraint on the upper bound for next work */

View File

@ -9,6 +9,7 @@ from test_framework.util import (
assert_greater_than,
assert_raises_rpc_error,
)
from test_framework.governance import EXPECTED_STDERR_NO_GOV_PRUNE
class FeatureBlockfilterindexPruneTest(BitcoinTestFramework):
@ -42,7 +43,7 @@ class FeatureBlockfilterindexPruneTest(BitcoinTestFramework):
assert_greater_than(len(self.nodes[0].getblockfilter(self.nodes[0].getblockhash(2))['filter']), 0)
self.log.info("start node without blockfilterindex")
self.restart_node(0, extra_args=["-fastprune", "-prune=1"], expected_stderr='Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.')
self.restart_node(0, extra_args=["-fastprune", "-prune=1"], expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)
self.log.info("make sure accessing the blockfilters throws an error")
assert_raises_rpc_error(-1, "Index is not enabled for filtertype basic", self.nodes[0].getblockfilter, self.nodes[0].getblockhash(2))
@ -51,17 +52,17 @@ class FeatureBlockfilterindexPruneTest(BitcoinTestFramework):
self.log.info("prune below the blockfilterindexes best block while blockfilters are disabled")
pruneheight_new = self.nodes[0].pruneblockchain(1000)
assert_greater_than(pruneheight_new, pruneheight)
self.stop_node(0, expected_stderr='Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.')
self.stop_node(0, expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)
self.log.info("make sure we get an init error when starting the node again with block filters")
self.nodes[0].assert_start_raises_init_error(
extra_args=["-fastprune", "-prune=1", "-blockfilterindex=1"],
expected_msg="Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.\nError: basic block filter index best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again)",
expected_msg=f"{EXPECTED_STDERR_NO_GOV_PRUNE}\nError: basic block filter index best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again)",
)
self.log.info("make sure the node starts again with the -reindex arg")
self.start_node(0, extra_args=["-fastprune", "-prune=1", "-blockfilterindex", "-reindex"])
self.stop_nodes(expected_stderr='Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.')
self.stop_nodes(expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)
if __name__ == '__main__':

View File

@ -11,6 +11,10 @@ This test takes 30 mins or more (up to 2 hours)
import os
from test_framework.blocktools import create_coinbase
from test_framework.governance import (
EXPECTED_STDERR_NO_GOV,
EXPECTED_STDERR_NO_GOV_PRUNE,
)
from test_framework.messages import CBlock
from test_framework.script import (
CScript,
@ -29,9 +33,6 @@ from test_framework.util import (
# compatible with pruning based on key creation time.
TIMESTAMP_WINDOW = 2 * 60 * 60
EXPECTED_STDERR_NO_GOV = "Warning: You are starting with governance validation disabled."
EXPECTED_STDERR_NO_GOV_PRUNE = EXPECTED_STDERR_NO_GOV + " This is expected because you are running a pruned node."
def mine_large_blocks(node, n):
# Make a large scriptPubKey for the coinbase transaction. This is OP_RETURN
# followed by 950k of OP_NOP. This would be non-standard in a non-coinbase

View File

@ -14,6 +14,7 @@ try:
except ImportError:
pass
from test_framework.messages import COIN
from test_framework.governance import EXPECTED_STDERR_NO_GOV_PRUNE
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal
from test_framework.wallet import MiniWallet
@ -402,7 +403,7 @@ class UTXOCacheTracepointTest(BitcoinTestFramework):
assert_equal(0, len(possible_cache_sizes))
assert_equal(EXPECTED_HANDLE_FLUSH_SUCCESS, handle_flush_succeeds)
self.stop_node(0, expected_stderr='Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.')
self.stop_node(0, expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)
if __name__ == '__main__':
UTXOCacheTracepointTest().main()

View File

@ -9,6 +9,7 @@ and that it responds to getdata requests for blocks correctly:
- send a block within 288 + 2 of the tip
- disconnect peers who request blocks older than that."""
from test_framework.messages import CInv, MSG_BLOCK, msg_getdata, NODE_BLOOM, NODE_NETWORK_LIMITED, NODE_HEADERS_COMPRESSED
from test_framework.governance import EXPECTED_STDERR_NO_GOV_PRUNE
from test_framework.p2p import P2PInterface
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal
@ -95,7 +96,7 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
# sync must be possible, node 1 is no longer in IBD and should therefore connect to node 0 (NODE_NETWORK_LIMITED)
self.sync_blocks([self.nodes[0], self.nodes[1]])
self.stop_node(0, expected_stderr='Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.')
self.stop_node(0, expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)
if __name__ == '__main__':

View File

@ -31,6 +31,7 @@ from test_framework.blocktools import (
create_coinbase,
TIME_GENESIS_BLOCK,
)
from test_framework.governance import EXPECTED_STDERR_NO_GOV_PRUNE
from test_framework.messages import (
CBlockHeader,
from_hex,
@ -125,7 +126,7 @@ class BlockchainTest(BitcoinTestFramework):
assert res['pruned']
assert not res['automatic_pruning']
self.restart_node(0, ['-stopatheight=207', '-txindex=0'], expected_stderr='Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.')
self.restart_node(0, ['-stopatheight=207', '-txindex=0'], expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)
res = self.nodes[0].getblockchaininfo()
# should have exact keys
assert_equal(sorted(res.keys()), keys)

View File

@ -6,6 +6,9 @@
import json
EXPECTED_STDERR_NO_GOV = "Warning: You are starting with governance validation disabled."
EXPECTED_STDERR_NO_GOV_PRUNE = f"{EXPECTED_STDERR_NO_GOV} This is expected because you are running a pruned node."
def prepare_object(node, object_type, parent_hash, creation_time, revision, name, amount, payment_address):
proposal_rev = revision
proposal_time = int(creation_time)

View File

@ -20,6 +20,7 @@ happened previously.
"""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.governance import EXPECTED_STDERR_NO_GOV_PRUNE
from test_framework.util import (
assert_equal,
set_node_times,
@ -213,7 +214,7 @@ class ImportRescanTest(BitcoinTestFramework):
variant.check(variant.sent_txid, variant.sent_amount, variant.confirmation_height)
for i, import_node in enumerate(IMPORT_NODES, 2):
if import_node.prune:
self.stop_node(i, expected_stderr='Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.')
self.stop_node(i, expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)