Skip to content

Commit

Permalink
do not request blobs if no blocks in range
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Jan 25, 2023
1 parent 606312a commit e252d89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/beacon-node/src/network/nodejs/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import type {PeerDiscovery} from "@libp2p/interface-peer-discovery";
import type {Components} from "libp2p/components";
import {prometheusMetrics} from "@libp2p/prometheus-metrics";
import {Registry} from "prom-client";
import {Libp2p} from "../interface.js";
import {yamux} from "@chainsafe/libp2p-yamux";
import {Libp2p} from "../interface.js";
import {createNoise} from "./noise.js";

export interface ILibp2pOptions {
Expand Down Expand Up @@ -46,7 +46,7 @@ export async function createNodejsLibp2p(options: ILibp2pOptions): Promise<Libp2
const yamuxInstance = yamux();
const mplexInstance = mplex({maxInboundStreams: 256});

return await createLibp2p({
return (await createLibp2p({
peerId: options.peerId,
addresses: {
listen: options.addresses.listen,
Expand Down Expand Up @@ -123,5 +123,5 @@ export async function createNodejsLibp2p(options: ILibp2pOptions): Promise<Libp2
agentVersion: options.lodestarVersion ? `lodestar/${options.lodestarVersion}` : "lodestar",
},
},
}) as Libp2p;
})) as Libp2p;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function doBeaconBlocksMaybeBlobsByRange(
else if (computeEpochAtSlot(request.startSlot) >= currentEpoch - config.MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS) {
// TODO EIP-4844: Do two requests at once for blocks and blobs
const blocks = await reqResp.beaconBlocksByRange(peerId, request);
const blobsSidecars = await reqResp.blobsSidecarsByRange(peerId, request);
const blobsSidecars = blocks.length > 0 ? await reqResp.blobsSidecarsByRange(peerId, request) : [];

const blockInputs: BlockInput[] = [];
let blobSideCarIndex = 0;
Expand Down

0 comments on commit e252d89

Please sign in to comment.