From 1ab6187071b78b05e443de9a33cb9be43e82f0d5 Mon Sep 17 00:00:00 2001 From: James Dorfman Date: Tue, 8 Oct 2024 04:50:58 +0000 Subject: [PATCH] Bug fix: when CheckChallenge(...) is called on a trimmed header, temporarily untrim it in order to extract the proof. Without this fix, there would be an exception in this scenario, because a trimmed header no longer has any proof information attached to it. This scenario was occuring when a pre-dynafed node with trimmed blocks would receive a new block header from its peer. The pre-dynafed node would try to validate the header by comparing its proof to the previous block's proof, and this would cause an exception if the previous block had pruned. New headers are not pruned as soon as they're received. Rather, they are pruned whenever the block index is flushed to disk. So, this behavior was only being observed in functional tests, when a pre-dynafed trimmed node was restarted. --- src/block_proof.cpp | 11 +++++++++-- src/block_proof.h | 2 +- src/validation.cpp | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/block_proof.cpp b/src/block_proof.cpp index 0c1a279d68..78a1765329 100644 --- a/src/block_proof.cpp +++ b/src/block_proof.cpp @@ -10,10 +10,17 @@ #include