mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-27 22:34:18 +02:00
Merge bitcoin/bitcoin#35044: contrib: Fix NameError in signet miner gbt()
701bc2dc02contrib: Fix NameError in signet miner gbt() (Torkel Rogstad) Pull request description: 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 in7b31332370when the gbt logic was extracted into its own method — the if-condition was updated but the logging call was not. ACKs for top commit: kevkevinpal: ACK [701bc2d](701bc2dc02) sedited: ACK701bc2dc02Tree-SHA512: 53764db954dd40b68d2f92279fd609732402fdbac4a1838aeee81d366b2b7fbc8da86b07f6f05cee62cb8ecdc514f6e0af1e59c65380eec38cbeaa58ec3c10ed
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user