Skip to content

Commit 6f61a11

Browse files
committed
fix remaining max_packet_size references
1 parent b405c2b commit 6f61a11

File tree

1 file changed

+6
-2
lines changed
  • packages/portalnetwork/src/networks/beacon

1 file changed

+6
-2
lines changed

packages/portalnetwork/src/networks/beacon/beacon.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ import debug from 'debug'
2121
import { getENR, shortId } from '../../util/util.js'
2222
import {
2323
FoundContent,
24-
MAX_PACKET_SIZE,
24+
MAX_UDP_PACKET_SIZE,
2525
RequestCode,
2626
encodeWithVariantPrefix,
27+
getTalkReqOverhead,
2728
randUint16,
2829
} from '../../wire/index.js'
2930
import { ContentMessageType, MessageCodes, PortalWireMessageType } from '../../wire/types.js'
@@ -573,7 +574,10 @@ export class BeaconLightClientNetwork extends BaseNetwork {
573574
const value = await this.findContentLocally(decodedContentMessage.contentKey)
574575
if (!value) {
575576
await this.enrResponse(decodedContentMessage.contentKey, src, requestId)
576-
} else if (value !== undefined && value.length < MAX_PACKET_SIZE) {
577+
} else if (
578+
value !== undefined &&
579+
value.length < MAX_UDP_PACKET_SIZE - getTalkReqOverhead(hexToBytes(this.networkId).byteLength)
580+
) {
577581
this.logger(
578582
'Found value for requested content ' +
579583
bytesToHex(decodedContentMessage.contentKey) +

0 commit comments

Comments
 (0)