Skip to content

Commit

Permalink
chore: remove use of set
Browse files Browse the repository at this point in the history
  • Loading branch information
jeluard committed Jan 25, 2024
1 parent 9ae3a9c commit 1b42805
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/beacon-node/src/api/impl/beacon/blocks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ export function getBeaconBlockApi({
await publishBlock(signedBlockOrContents, opts);
},

async getBlobSidecars(blockId, indices) {
async getBlobSidecars(blockId, indices = []) {
const {block, executionOptimistic} = await resolveBlockId(chain, blockId);
const blockRoot = config.getForkTypes(block.message.slot).BeaconBlock.hashTreeRoot(block.message);

Expand All @@ -419,11 +419,10 @@ export function getBeaconBlockApi({
throw Error(`blobSidecars not found in db for slot=${block.message.slot} root=${toHexString(blockRoot)}`);
}

const indicesSet = new Set(indices);
return {
executionOptimistic,
// Return all sidecars if no indices are specified, only the requested ones (identified by `indices`) otherwise
data: indicesSet.size == 0 ? blobSidecars : blobSidecars.filter(({index}) => indicesSet.has(index)),
data: indices.length == 0 ? blobSidecars : blobSidecars.filter(({index}) => indices.includes(index)),
};
},
};
Expand Down

0 comments on commit 1b42805

Please sign in to comment.