mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-24 18:23:26 -03:00
Merge bitcoin/bitcoin#30762: [28.x] rc backports
Some checks failed
Some checks failed
b2a137929a
depends: build libevent with -D_GNU_SOURCE (fanquake)199bb09d88
test: fixing failing system_tests/run_command under some Locales (Jadi)342baabaff
test: Avoid intermittent timeout in p2p_headers_sync_with_minchainwork.py (MarcoFalke)5577d5a3c0
test: fix `TestShell` initialization (late follow-up for #30463) (Sebastian Falbesoner) Pull request description: Backports: * https://github.com/bitcoin/bitcoin/pull/30714 * https://github.com/bitcoin/bitcoin/pull/30743 * https://github.com/bitcoin/bitcoin/pull/30761 * https://github.com/bitcoin/bitcoin/pull/30788 ACKs for top commit: willcl-ark: ACKb2a137929a
achow101: ACKb2a137929a
stickies-v: ACKb2a137929a
Tree-SHA512: bf08ac0c613395def974a1b287345d4a64edc066c14f8c9f0184478b0e33e48333760eeb6e96b6b5fbafbb21b40d01875e3f526213a2734e226b2e111d71f3a3
This commit is contained in:
commit
fa46088440
4 changed files with 21 additions and 4 deletions
|
@ -14,6 +14,7 @@ define $(package)_set_vars
|
|||
$(package)_config_opts=-DEVENT__DISABLE_BENCHMARK=ON -DEVENT__DISABLE_OPENSSL=ON
|
||||
$(package)_config_opts+=-DEVENT__DISABLE_SAMPLES=ON -DEVENT__DISABLE_REGRESS=ON
|
||||
$(package)_config_opts+=-DEVENT__DISABLE_TESTS=ON -DEVENT__LIBRARY_TYPE=STATIC
|
||||
$(package)_cppflags += -D_GNU_SOURCE
|
||||
$(package)_cppflags_mingw32=-D_WIN32_WINNT=0x0601
|
||||
|
||||
ifeq ($(NO_HARDEN),)
|
||||
|
|
|
@ -54,8 +54,8 @@ BOOST_AUTO_TEST_CASE(run_command)
|
|||
}
|
||||
{
|
||||
// Return non-zero exit code, with error message for stderr
|
||||
const std::string command{"ls nosuchfile"};
|
||||
const std::string expected{"No such file or directory"};
|
||||
const std::string command{"python3 -c 'import sys; print(\"err\", file=sys.stderr); sys.exit(2)'"};
|
||||
const std::string expected{"err"};
|
||||
BOOST_CHECK_EXCEPTION(RunCommandParseJSON(command), std::runtime_error, [&](const std::runtime_error& e) {
|
||||
const std::string what(e.what());
|
||||
BOOST_CHECK(what.find(strprintf("RunCommandParseJSON error: process(%s) returned", command)) != std::string::npos);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2019-2022 The Bitcoin Core developers
|
||||
# Copyright (c) 2019-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""Test that we reject low difficulty headers to prevent our block tree from filling up with useless bloat"""
|
||||
|
@ -21,6 +21,8 @@ from test_framework.blocktools import (
|
|||
|
||||
from test_framework.util import assert_equal
|
||||
|
||||
import time
|
||||
|
||||
NODE1_BLOCKS_REQUIRED = 15
|
||||
NODE2_BLOCKS_REQUIRED = 2047
|
||||
|
||||
|
@ -48,6 +50,10 @@ class RejectLowDifficultyHeadersTest(BitcoinTestFramework):
|
|||
self.connect_nodes(0, 2)
|
||||
self.connect_nodes(0, 3)
|
||||
|
||||
def mocktime_all(self, time):
|
||||
for n in self.nodes:
|
||||
n.setmocktime(time)
|
||||
|
||||
def test_chains_sync_when_long_enough(self):
|
||||
self.log.info("Generate blocks on the node with no required chainwork, and verify nodes 1 and 2 have no new headers in their headers tree")
|
||||
with self.nodes[1].assert_debug_log(expected_msgs=["[net] Ignoring low-work chain (height=14)"]), self.nodes[2].assert_debug_log(expected_msgs=["[net] Ignoring low-work chain (height=14)"]), self.nodes[3].assert_debug_log(expected_msgs=["Synchronizing blockheaders, height: 14"]):
|
||||
|
@ -149,7 +155,9 @@ class RejectLowDifficultyHeadersTest(BitcoinTestFramework):
|
|||
|
||||
self.reconnect_all()
|
||||
|
||||
self.mocktime_all(int(time.time())) # Temporarily hold time to avoid internal timeouts
|
||||
self.sync_blocks(timeout=300) # Ensure tips eventually agree
|
||||
self.mocktime_all(0)
|
||||
|
||||
|
||||
def run_test(self):
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
# Copyright (c) 2019-2022 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
import pathlib
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
|
||||
|
||||
class TestShell:
|
||||
"""Wrapper Class for BitcoinTestFramework.
|
||||
|
||||
|
@ -67,7 +69,13 @@ class TestShell:
|
|||
# This implementation enforces singleton pattern, and will return the
|
||||
# previously initialized instance if available
|
||||
if not TestShell.instance:
|
||||
TestShell.instance = TestShell.__TestShell()
|
||||
# BitcoinTestFramework instances are supposed to be constructed with the path
|
||||
# of the calling test in order to find shared data like configuration and the
|
||||
# cache. Since TestShell is meant for interactive use, there is no concrete
|
||||
# test; passing a dummy name is fine though, as only the containing directory
|
||||
# is relevant for successful initialization.
|
||||
tests_directory = pathlib.Path(__file__).resolve().parent.parent
|
||||
TestShell.instance = TestShell.__TestShell(tests_directory / "testshell_dummy.py")
|
||||
TestShell.instance.running = False
|
||||
return TestShell.instance
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue