Skip to content

Commit 8a8a954

Browse files
author
ScottyPoi
committed
RPC: fix Ping conditional
1 parent 9c55b71 commit 8a8a954

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/cli/src/rpc/modules/portal.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { RunStatusCode } from '@lodestar/light-client'
2020
import type { Debugger } from 'debug'
2121
import type { BeaconNetwork, HistoryNetwork, PortalNetwork, StateNetwork } from 'portalnetwork'
2222
import type { GetEnrResult } from '../schema/types.js'
23+
import { BitArray } from '@chainsafe/ssz'
2324

2425
const methods = [
2526
// state
@@ -573,7 +574,7 @@ export class portal {
573574
)
574575

575576
let encodedPayload = undefined
576-
if (payload !== undefined) {
577+
if (payload !== undefined && payload !== null) {
577578
encodedPayload = encodeExtensionPayloadFromJson(extension, payload)
578579
}
579580
const pong = await this._history.sendPing(encodedENR, extension, encodedPayload)
@@ -597,7 +598,7 @@ export class portal {
597598
`PING request received on StateNetwork for ${shortId(encodedENR.nodeId)} with extension ${extension}`,
598599
)
599600
let encodedPayload = undefined
600-
if (payload !== undefined) {
601+
if (payload !== undefined && payload !== null) {
601602
encodedPayload = encodeExtensionPayloadFromJson(extension, payload)
602603
}
603604
const pong = await this._state.sendPing(encodedENR, extension, encodedPayload)
@@ -623,7 +624,7 @@ export class portal {
623624
)
624625

625626
let encodedPayload = undefined
626-
if (payload !== undefined) {
627+
if (payload !== undefined && payload !== null) {
627628
encodedPayload = encodeExtensionPayloadFromJson(extension, payload)
628629
}
629630

0 commit comments

Comments
 (0)