Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ BITCOIN_TESTS =\
test/llmq_snapshot_tests.cpp \
test/llmq_utils_tests.cpp \
test/logging_tests.cpp \
test/masternode_params_tests.cpp \
test/dbwrapper_tests.cpp \
test/validation_tests.cpp \
test/mempool_tests.cpp \
Expand Down
60 changes: 60 additions & 0 deletions src/test/masternode_params_tests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright (c) 2025 The Dash Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <init.h>
#include <test/util/setup_common.h>
#include <util/system.h>

#include <boost/test/unit_test.hpp>

//! These tests cover the parameter interactions triggered by
//! -masternodeblsprivkey in InitParameterInteraction. Previously this was
//! exercised by test/functional/feature_masternode_params.py, which spun up
//! full nodes only to read back arg state.
BOOST_FIXTURE_TEST_SUITE(masternode_params_tests, BasicTestingSetup)

//! Without -masternodeblsprivkey, masternode-driven defaults must not fire.
BOOST_AUTO_TEST_CASE(no_masternode_key_leaves_defaults)
{
ArgsManager args;
InitParameterInteraction(args);

BOOST_CHECK(!args.IsArgSet("-disablewallet"));
BOOST_CHECK(!args.IsArgSet("-peerblockfilters"));
BOOST_CHECK(!args.IsArgSet("-blockfilterindex"));
}

//! Setting -masternodeblsprivkey must auto-enable -disablewallet,
//! -peerblockfilters and -blockfilterindex=basic.
BOOST_AUTO_TEST_CASE(masternode_key_enables_filters_and_disables_wallet)
{
ArgsManager args;
args.ForceSetArg("-masternodeblsprivkey", "dummy");

InitParameterInteraction(args);

BOOST_CHECK(args.GetBoolArg("-disablewallet", false));
BOOST_CHECK(args.GetBoolArg("-peerblockfilters", false));
BOOST_CHECK_EQUAL(args.GetArg("-blockfilterindex", ""), "basic");
}

//! Explicit user overrides must win over the masternode defaults
//! (SoftSet semantics): the user can still disable filters and keep the
//! wallet on a masternode.
BOOST_AUTO_TEST_CASE(masternode_key_respects_user_overrides)
{
ArgsManager args;
args.ForceSetArg("-masternodeblsprivkey", "dummy");
args.ForceSetArg("-disablewallet", "0");
args.ForceSetArg("-peerblockfilters", "0");
args.ForceSetArg("-blockfilterindex", "0");

InitParameterInteraction(args);

BOOST_CHECK(!args.GetBoolArg("-disablewallet", true));
BOOST_CHECK(!args.GetBoolArg("-peerblockfilters", true));
BOOST_CHECK_EQUAL(args.GetArg("-blockfilterindex", ""), "0");
}

BOOST_AUTO_TEST_SUITE_END()
95 changes: 0 additions & 95 deletions test/functional/feature_masternode_params.py

This file was deleted.

1 change: 0 additions & 1 deletion test/functional/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@
'feature_llmq_singlenode.py', # NOTE: needs dash_hash to pass
'feature_dip4_coinbasemerkleroots.py', # NOTE: needs dash_hash to pass
'feature_mnehf.py', # NOTE: needs dash_hash to pass
'feature_masternode_params.py', # NOTE: needs dash_hash to pass
'feature_governance.py --legacy-wallet',
'feature_governance.py --descriptors',
'feature_governance_cl.py --legacy-wallet',
Expand Down
1 change: 1 addition & 0 deletions test/util/data/non-backported.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ src/test/dip0020opcodes_tests.cpp
src/test/dynamic_activation*.cpp
src/test/evo*.cpp
src/test/llmq*.cpp
src/test/masternode_params_tests.cpp
src/test/util/llmq_tests.h
src/test/governance*.cpp
src/unordered_lru_cache.h
Expand Down
Loading