fix mismatched use of gbt implementations

This commit is contained in:
Mononaut 2023-07-19 11:18:04 +09:00
parent 928a8be846
commit cde4af5930
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
2 changed files with 14 additions and 4 deletions

View File

@ -211,9 +211,12 @@ class MempoolBlocks {
const start = Date.now(); const start = Date.now();
// reset mempool short ids // reset mempool short ids
this.resetUids(); if (saveResults) {
this.resetUids();
}
// set missing short ids
for (const tx of Object.values(newMempool)) { for (const tx of Object.values(newMempool)) {
this.setUid(tx, true); this.setUid(tx, !saveResults);
} }
const accelerations = useAccelerations ? mempool.getAccelerations() : {}; const accelerations = useAccelerations ? mempool.getAccelerations() : {};
@ -497,6 +500,8 @@ class MempoolBlocks {
} }
} }
const isAccelerated : { [txid: string]: boolean } = {};
const sizeLimit = (config.MEMPOOL.BLOCK_WEIGHT_UNITS / 4) * 1.2; const sizeLimit = (config.MEMPOOL.BLOCK_WEIGHT_UNITS / 4) * 1.2;
// update this thread's mempool with the results // update this thread's mempool with the results
let mempoolTx: MempoolTransactionExtended; let mempoolTx: MempoolTransactionExtended;
@ -526,10 +531,11 @@ class MempoolBlocks {
} }
const acceleration = accelerations[txid]; const acceleration = accelerations[txid];
if (acceleration && (!accelerationPool || acceleration.pools.includes(accelerationPool))) { if (isAccelerated[txid] || (acceleration && (!accelerationPool || acceleration.pools.includes(accelerationPool)))) {
mempoolTx.acceleration = true; mempoolTx.acceleration = true;
for (const ancestor of mempoolTx.ancestors || []) { for (const ancestor of mempoolTx.ancestors || []) {
mempool[ancestor.txid].acceleration = true; mempool[ancestor.txid].acceleration = true;
isAccelerated[ancestor.txid] = true;
} }
} else { } else {
delete mempoolTx.acceleration; delete mempoolTx.acceleration;

View File

@ -675,7 +675,11 @@ class WebsocketHandler {
} }
} else { } else {
if ((config.MEMPOOL_SERVICES.ACCELERATIONS)) { if ((config.MEMPOOL_SERVICES.ACCELERATIONS)) {
projectedBlocks = await mempoolBlocks.$rustUpdateBlockTemplates(auditMempool, Object.keys(auditMempool).length, [], [], isAccelerated, block.extras.pool.id); if (config.MEMPOOL.RUST_GBT) {
projectedBlocks = await mempoolBlocks.$rustUpdateBlockTemplates(auditMempool, Object.keys(auditMempool).length, [], [], isAccelerated, block.extras.pool.id);
} else {
projectedBlocks = await mempoolBlocks.$makeBlockTemplates(auditMempool, false, isAccelerated, block.extras.pool.id);
}
} else { } else {
projectedBlocks = mempoolBlocks.getMempoolBlocksWithTransactions(); projectedBlocks = mempoolBlocks.getMempoolBlocksWithTransactions();
} }