Skip to content

Commit

Permalink
fix remaining max_packet_size references
Browse files Browse the repository at this point in the history
  • Loading branch information
acolytec3 committed Feb 28, 2025
1 parent b405c2b commit 6f61a11
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/portalnetwork/src/networks/beacon/beacon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import debug from 'debug'
import { getENR, shortId } from '../../util/util.js'
import {
FoundContent,
MAX_PACKET_SIZE,
MAX_UDP_PACKET_SIZE,
RequestCode,
encodeWithVariantPrefix,
getTalkReqOverhead,
randUint16,
} from '../../wire/index.js'
import { ContentMessageType, MessageCodes, PortalWireMessageType } from '../../wire/types.js'
Expand Down Expand Up @@ -573,7 +574,10 @@ export class BeaconLightClientNetwork extends BaseNetwork {
const value = await this.findContentLocally(decodedContentMessage.contentKey)
if (!value) {
await this.enrResponse(decodedContentMessage.contentKey, src, requestId)
} else if (value !== undefined && value.length < MAX_PACKET_SIZE) {
} else if (
value !== undefined &&
value.length < MAX_UDP_PACKET_SIZE - getTalkReqOverhead(hexToBytes(this.networkId).byteLength)
) {
this.logger(
'Found value for requested content ' +
bytesToHex(decodedContentMessage.contentKey) +
Expand Down

0 comments on commit 6f61a11

Please sign in to comment.