Add missing audit data to cached blocks

This commit is contained in:
Mononaut 2023-06-20 17:03:24 -04:00
parent 69e6b164b9
commit 736b997104
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E

View File

@ -6,6 +6,7 @@ import blocksSummariesRepository from '../repositories/BlocksSummariesRepository
import { $sync } from './replicator';
import config from '../config';
import { Common } from '../api/common';
import blocks from '../api/blocks';
const BATCH_SIZE = 16;
@ -116,6 +117,13 @@ class AuditReplication {
expectedFees: auditSummary.expectedFees,
expectedWeight: auditSummary.expectedWeight,
});
// add missing data to cached blocks
const cachedBlock = blocks.getBlocks().find(block => block.id === blockHash);
if (cachedBlock) {
cachedBlock.extras.matchRate = auditSummary.matchRate;
cachedBlock.extras.expectedFees = auditSummary.expectedFees || null;
cachedBlock.extras.expectedWeight = auditSummary.expectedWeight || null;
}
}
}