From 2dbbc0819516d805389b29515238a2f2b3f234f6 Mon Sep 17 00:00:00 2001 From: Gerold Steiner Date: Mon, 2 Nov 2026 14:05:20 +0000 Subject: [PATCH] Check mined block count survives node restart --- tests/network/05-mining/test.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/network/05-mining/test.sh b/tests/network/05-mining/test.sh index 20215326..64131c2a 100755 --- a/tests/network/05-mining/test.sh +++ b/tests/network/05-mining/test.sh @@ -120,6 +120,11 @@ sleep 3 # Verify it can mine more blocks assert_success "test_wait_for_log '$LOG_DIR/${CURRENT_TEST}_miner-restart.log' 'Block .* mined' 120" "Should mine blocks after restart" +# A fresh chain can satisfy the new-block log check. Catch a restart that +# loses the existing block count before mining resumes. +RESTART_BLOCK_COUNT=$(modal node inspect --dir ./tmp/miner | sed -n 's/^Total Blocks: \([0-9][0-9]*\).*/\1/p') +[[ "$RESTART_BLOCK_COUNT" =~ ^[0-9]+$ ]] || test_fail "Restarted miner should report a block count" +assert_number "$RESTART_BLOCK_COUNT" ">=" "$BLOCK_COUNT" "Restart should retain blocks mined before shutdown" # Finalize test test_finalize