Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | const { logPeriod } = require('../../utils/debug');
const { getCurrentSlotId } = require('../../utils');
const submitPeriod = require('./submitPeriod');
module.exports = (height, bridgeState) => {
if (bridgeState.isReplay()) return;
Object.values(bridgeState.completePeriods)
.forEach(p => {
if (p.status === 'onchain' && height - p.height > 32) {
logPeriod('Pruning old period from cache: %s', p.blocksRoot);
delete bridgeState.completePeriods[p.blocksRoot];
}
});
const proposedPeriods = Object.values(bridgeState.completePeriods)
.filter(({ status }) => status === 'proposed');
proposedPeriods.forEach(async periodProposal => {
await submitPeriod(periodProposal, bridgeState);
});
}; |