@xyo-network/xl1-protocol-sdk 1.21.2 → 1.21.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3997,16 +3997,16 @@ var SimpleBlockValidationViewer = class extends AbstractCreatableProvider {
3997
3997
  const validateState = state ? this.doValidateState.bind(this) : void 0;
3998
3998
  const chainIdAtBlockNumber = (blockNumber) => this.chainContractViewer.chainIdAtBlockNumber(blockNumber);
3999
3999
  const qualification = { head: headBlock._hash, range: asXL1BlockRange11([0, headBlock.block], true) };
4000
- const [protocolResults = [], stateResults = []] = await Promise.all([
4000
+ const [protocolResults, stateResults] = await Promise.all([
4001
4001
  validateProtocol?.(blocksWithMeta, chainIdAtBlockNumber),
4002
4002
  validateState?.(blocksWithMeta, chainIdAtBlockNumber)
4003
4003
  ]);
4004
- const blockResults = protocolResults.map((r, i) => {
4004
+ const blockResults = blocksWithMeta.map((r, i) => {
4005
4005
  const errors = [];
4006
- if (!isHydratedBlock(r)) {
4007
- errors.push(...r);
4006
+ if (protocolResults && !isHydratedBlock(protocolResults[i])) {
4007
+ errors.push(...protocolResults[i]);
4008
4008
  }
4009
- if (!isHydratedBlock(stateResults[i])) {
4009
+ if (stateResults && !isHydratedBlock(stateResults[i])) {
4010
4010
  errors.push(...stateResults[i]);
4011
4011
  }
4012
4012
  return errors.length === 0 ? r : errors;
@@ -4628,12 +4628,12 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4628
4628
  pruned += pruneHashes.length;
4629
4629
  total += batch.length;
4630
4630
  await this.pendingBlocksArchivist.delete(pruneHashes);
4631
- cursor = batch[0]._sequence;
4632
- batch = await this.pendingBlocksArchivist.next({
4631
+ cursor = batch.at(-1)?._sequence;
4632
+ batch = cursor ? await this.pendingBlocksArchivist.next({
4633
4633
  limit: batchSize,
4634
4634
  cursor,
4635
4635
  order: "desc"
4636
- });
4636
+ }) : [];
4637
4637
  }
4638
4638
  return [pruned, total];
4639
4639
  }