Skip to content
Open
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
11 changes: 8 additions & 3 deletions src/test/util_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,9 +797,14 @@ BOOST_AUTO_TEST_CASE(util_time_GetTime)
BOOST_CHECK_EQUAL(111000, GetTimeMillis(true));
BOOST_CHECK_EQUAL(111000000, GetTimeMicros(true));

const auto ntime = GetSystemTimeInSeconds();
BOOST_CHECK_EQUAL(ntime, GetTimeMillis()/1000);
BOOST_CHECK_EQUAL(ntime, GetTimeMicros()/1000000);
const auto ntime = GetSystemTimeInSeconds();
const auto ms_secs = GetTimeMillis()/1000;
const auto us_secs = GetTimeMicros()/1000000;
// Capture all three before asserting: a second boundary between calls
// would make truncated values differ by 1. Time only moves forward so
// later reads are at most 1 second ahead of ntime.
BOOST_CHECK(ms_secs >= ntime && ms_secs <= ntime + 1);
BOOST_CHECK(us_secs >= ntime && us_secs <= ntime + 1);
}

SetMockTime(0);
Expand Down
10 changes: 9 additions & 1 deletion test/functional/feature_fee_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,15 @@ def check_estimates(node, fees_seen):
"""Call estimatesmartfee and verify that the estimates meet certain invariants."""

delta = 1.0e-6 # account for rounding error
last_feerate = float(max(fees_seen))
# Mirror upstream: use the highest of fees_seen, mempoolminfee and
# minrelaytxfee as the ceiling so the monotonicity check tolerates the
# documented rare edge case where a shorter-horizon sub-estimate fails
# while a longer one succeeds (bitcoin/bitcoin#11800).
mempool_info = node.getmempoolinfo()
feerate_ceiling = max(float(max(fees_seen)),
float(mempool_info["mempoolminfee"]),
float(mempool_info["minrelaytxfee"]))
last_feerate = feerate_ceiling
all_smart_estimates = [node.estimatesmartfee(i) for i in range(1, 26)]
for i, e in enumerate(all_smart_estimates): # estimate is for i+1
feerate = float(e["feerate"])
Expand Down
26 changes: 24 additions & 2 deletions test/functional/test_framework/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,23 @@ def stop_node(self, expected_stderr=''):
try:
self.stop()
except http.client.CannotSendRequest:
self.log.exception("Unable to stop node.")
self.log.debug("Unable to stop node (CannotSendRequest — already stopping).")
except ConnectionRefusedError:
# encryptwallet and similar RPCs trigger an internal shutdown before
# returning, so by the time we send the stop RPC the HTTP server is
# already gone. authproxy retries on RemoteDisconnected (a
# ConnectionResetError subclass) and gets ConnectionRefusedError.
# Treat this as "node already stopping" — wait_until_stopped handles the rest.
self.log.debug("Node already stopping or stopped (connection refused).")
except subprocess.CalledProcessError as e:
# If stop command fails (e.g., node already stopping), just log it
self.log.debug("Stop command failed, node may already be stopping: %s", e)
except JSONRPCException as e:
# -342 is "non-JSON HTTP response" — the 503 the HTTP server returns
# mid-shutdown. Any other RPC error is unexpected and should propagate.
if e.error.get('code') == -342:
self.log.debug("Node already shutting down (HTTP 503): %s", e)
else:
raise

# Check that stderr is as expected
self.stderr.seek(0)
Expand Down Expand Up @@ -267,6 +280,15 @@ def assert_start_raises_init_error(self, extra_args=None, expected_msg=None, mat
except (FailedToStartError, JSONRPCException) as e:
self.log.debug('tapyrusd failed to start: %s', e)
self.running = False
if self.process is not None:
# The process may still be alive (e.g. slow start that timed out,
# or RPC timeout on getblockcount). Kill it and wait so it releases
# the data directory lock before the next start attempt.
try:
self.process.kill()
except OSError:
pass
self.process.wait()
self.process = None
# Check stderr for expected message
if expected_msg is not None:
Expand Down
16 changes: 16 additions & 0 deletions test/lint/lint-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@ else
PASSED_SCRIPTS+=("$SCRIPT_NAME")
fi

# Run the lock ordering lint check (Python script)
SCRIPT_NAME="lint-lock-ordering.py"
TOTAL_SCRIPTS=$((TOTAL_SCRIPTS + 1))

set +e
python3 "${SCRIPTDIR}"/"$SCRIPT_NAME"
SCRIPT_EXIT_CODE=$?
set -e

if [ $SCRIPT_EXIT_CODE -ne 0 ]; then
FAILED_SCRIPTS+=("$SCRIPT_NAME")
EXIT_CODE=1
else
PASSED_SCRIPTS+=("$SCRIPT_NAME")
fi

echo "========================================="
echo "Lint Summary"
echo "========================================="
Expand Down
Loading
Loading