Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport: Merge bitcoin#20609, 20731, 20683, 20747, 20761 #5510

Merged
merged 5 commits into from
Aug 8, 2023
Merged
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
16 changes: 11 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,11 @@ AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"])

AC_MSG_CHECKING([whether to build test_dash])
if test x$use_tests = xyes; then
AC_MSG_RESULT([yes])
if test "x$enable_fuzz" = "xyes"; then
AC_MSG_RESULT([no, because fuzzing is enabled])
else
AC_MSG_RESULT([yes])
fi
BUILD_TEST="yes"
else
AC_MSG_RESULT([no])
Expand Down Expand Up @@ -1877,11 +1881,13 @@ if test x$bitcoin_enable_qt != xno; then
echo " with qr = $use_qr"
fi
echo " with zmq = $use_zmq"
echo " with test = $use_tests"
echo " with bench = $use_bench"
if test x$use_tests != xno; then
echo " with fuzz = $enable_fuzz"
if test x$enable_fuzz == xno; then
echo " with test = $use_tests"
else
echo " with test = not building test_dash because fuzzing is enabled"
echo " with fuzz = $enable_fuzz"
fi
echo " with bench = $use_bench"
echo " with upnp = $use_upnp"
echo " with natpmp = $use_natpmp"
echo " use asm = $use_asm"
Expand Down
1 change: 0 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,6 @@ void SetupServerArgs(NodeContext& node)
argsman.AddArg("-checkmempool=<n>", strprintf("Run checks every <n> transactions (default: %u, regtest: %u)", defaultChainParams->DefaultConsistencyChecks(), regtestChainParams->DefaultConsistencyChecks()), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-checkpoints", strprintf("Enable rejection of any forks from the known historical chain until block 1450000 (default: %u)", DEFAULT_CHECKPOINTS_ENABLED), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-deprecatedrpc=<method>", "Allows deprecated RPC method(s) to be used", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-dropmessagestest=<n>", "Randomly drop 1 of every <n> network messages", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-limitancestorcount=<n>", strprintf("Do not accept transactions if number of in-mempool ancestors is <n> or more (default: %u)", DEFAULT_ANCESTOR_LIMIT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-limitancestorsize=<n>", strprintf("Do not accept transactions whose size with all in-mempool ancestors exceeds <n> kilobytes (default: %u)", DEFAULT_ANCESTOR_SIZE_LIMIT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-limitdescendantcount=<n>", strprintf("Do not accept transactions if any ancestor would have <n> or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
Expand Down
5 changes: 0 additions & 5 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2791,11 +2791,6 @@ void PeerManagerImpl::ProcessMessage(
LogPrint(BCLog::NET, "received: %s (%u bytes) peer=%d\n", SanitizeString(msg_type), vRecv.size(), pfrom.GetId());
statsClient.inc("message.received." + SanitizeString(msg_type), 1.0f);

if (gArgs.IsArgSet("-dropmessagestest") && GetRand(gArgs.GetArg("-dropmessagestest", 0)) == 0)
{
LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n");
return;
}

PeerRef peer = GetPeerRef(pfrom.GetId());
if (peer == nullptr) return;
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/rawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static UniValue getrawtransaction(const JSONRPCRequest& request)
{RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::STR_HEX, "txid", "The transaction id"},
{RPCResult::Type::STR, "vout", ""},
{RPCResult::Type::NUM, "vout", "The output number"},
{RPCResult::Type::OBJ, "scriptSig", "The script",
{
{RPCResult::Type::STR, "asm", "asm"},
Expand Down
8 changes: 7 additions & 1 deletion src/test/fuzz/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ FUZZ_TARGET_INIT(script, initialize_script)

TxoutType which_type;
(void)IsStandard(script, which_type);
if (which_type == TxoutType::NULL_DATA) {
assert(script.IsUnspendable());
}
if (script.IsUnspendable()) {
assert(which_type == TxoutType::NULL_DATA ||
which_type == TxoutType::NONSTANDARD);
}

(void)RecursiveDynamicUsage(script);

Expand All @@ -77,7 +84,6 @@ FUZZ_TARGET_INIT(script, initialize_script)

(void)script.IsPayToScriptHash();
(void)script.IsPushOnly();
(void)script.IsUnspendable();
(void)script.GetSigOpCount(/* fAccurate= */ false);

(void)FormatScript(script);
Expand Down
3 changes: 1 addition & 2 deletions test/functional/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,13 +610,12 @@ def start_nodes(self, extra_args=None, *args, **kwargs):
def stop_node(self, i, expected_stderr='', wait=0):
"""Stop a dashd test node"""
self.nodes[i].stop_node(expected_stderr=expected_stderr, wait=wait)
self.nodes[i].wait_until_stopped()

def stop_nodes(self, expected_stderr='', wait=0):
"""Stop multiple dashd test nodes"""
for node in self.nodes:
# Issue RPC to stop nodes
node.stop_node(expected_stderr=expected_stderr, wait=wait)
node.stop_node(expected_stderr=expected_stderr, wait=wait, wait_until_stopped=False)

for node in self.nodes:
# Wait for nodes to stop
Expand Down
5 changes: 4 additions & 1 deletion test/functional/test_framework/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def get_wallet_rpc(self, wallet_name):
def version_is_at_least(self, ver):
return self.version is None or self.version >= ver

def stop_node(self, expected_stderr='', wait=0):
def stop_node(self, expected_stderr='', *, wait=0, wait_until_stopped=True):
"""Stop the node."""
if not self.running:
return
Expand All @@ -344,6 +344,9 @@ def stop_node(self, expected_stderr='', wait=0):

del self.p2ps[:]

if wait_until_stopped:
self.wait_until_stopped()

def is_node_stopped(self):
"""Checks whether the node has stopped.

Expand Down
Loading