Refresh jobs when parent template blob changes
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 54s

This commit is contained in:
Codex Bot
2026-03-22 19:23:58 +01:00
parent 4207f95790
commit 9c1de72157

View File

@@ -198,7 +198,10 @@ process.on('message', function (message) {
let new_hash = Buffer.alloc(32); let new_hash = Buffer.alloc(32);
buffer.copy(new_hash, 0, previousOffset, 39); buffer.copy(new_hash, 0, previousOffset, 39);
try { try {
if (!currentBlockTemplate[0] || new_hash.toString('hex') !== currentBlockTemplate[0].prev_hash.toString('hex') || (currentBlockTemplate[0].num_transactions == 0 && message.block.num_transactions > 0)) { const prevHashChanged = !currentBlockTemplate[0] || new_hash.toString('hex') !== currentBlockTemplate[0].prev_hash.toString('hex');
const txCountBecameNonZero = currentBlockTemplate[0] && currentBlockTemplate[0].num_transactions == 0 && message.block.num_transactions > 0;
const templateBlobChanged = currentBlockTemplate[0] && message.block.blocktemplate_blob !== currentBlockTemplate[0].blocktemplate_blob;
if (!currentBlockTemplate[0] || prevHashChanged || txCountBecameNonZero || templateBlobChanged) {
log('info', logSystem, 'New %s block to mine at height %d w/ difficulty of %d (%d transactions)', [miningBackends.getActiveMiningBackend().coin, message.block.height, message.block.difficulty, (message.block.num_transactions || 0)]); log('info', logSystem, 'New %s block to mine at height %d w/ difficulty of %d (%d transactions)', [miningBackends.getActiveMiningBackend().coin, message.block.height, message.block.difficulty, (message.block.num_transactions || 0)]);
processBlockTemplate(message.block); processBlockTemplate(message.block);
return; return;