From 701bc2dc02f73a10498ecf70c5d3523e0bb6b953 Mon Sep 17 00:00:00 2001 From: Torkel Rogstad Date: Fri, 10 Apr 2026 10:23:30 +0200 Subject: [PATCH] contrib: Fix NameError in signet miner gbt() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The logging.warning call referenced `bci["bestblockhash"]`, a variable from the calling scope `do_generate()` that is not available inside the `Generate.gbt()` method. This would crash with a NameError when getblocktemplate returned a template based on an unexpected previous block. Use the `bestblockhash` parameter that was already being passed in and used correctly in the comparison on the line above. The bug was introduced in 7b31332370 when the gbt logic was extracted into its own method — the if-condition was updated but the logging call was not. --- contrib/signet/miner | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/signet/miner b/contrib/signet/miner index f46d88b52e1..a7548841eea 100755 --- a/contrib/signet/miner +++ b/contrib/signet/miner @@ -333,7 +333,7 @@ class Generate: def gbt(self, bcli, bestblockhash, now): tmpl = json.loads(bcli("getblocktemplate", '{"rules":["signet","segwit"]}')) if tmpl["previousblockhash"] != bestblockhash: - logging.warning("GBT based off unexpected block (%s not %s), retrying", tmpl["previousblockhash"], bci["bestblockhash"]) + logging.warning("GBT based off unexpected block (%s not %s), retrying", tmpl["previousblockhash"], bestblockhash) time.sleep(1) return None