From f3433874704b71bf17ad07ca387d3556291ceee0 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 28 May 2023 17:36:35 +1000 Subject: [PATCH] Make forced block submission hash check result more informative. --- src/stratifier.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/stratifier.c b/src/stratifier.c index 95228488..0198dfa3 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -2082,9 +2082,18 @@ static bool local_block_submit(ckpool_t *ckp, char *gbt_block, const uchar *flip /* Check failures that may be inconclusive but were submitted via other * means or accepted due to precious block call. */ if (!ret) { + /* If the block is accepted locally, it means we may have + * displaced a known block, and are now working on this fork. + * This makes the most sense since if we solve the next block, + * it validates this one as the best chain, orphaning the other + * block. In the case of mainnet, it means we have found a stale + * block and are trying to force ours ahead of the other. In + * a low diff environment we may have successive blocks, and + * this will be the last one solved locally. Trying to optimise + * regtest/testnet will optimise against the mainnet case. */ if (generator_get_blockhash(ckp, height, heighthash)) { ret = !strncmp(rhash, heighthash, 64); - LOGWARNING("Hash for block height %d confirms block was %s", + LOGWARNING("Hash for forced possibly stale block, height %d confirms block was %s", height, ret ? "ACCEPTED" : "REJECTED"); } }