Skip to content

Commit 8369727

Browse files
KolbyMLScottyPoi
authored andcommitted
Remove invalid ping extension error
1 parent 315a209 commit 8369727

File tree

2 files changed

+0
-31
lines changed

2 files changed

+0
-31
lines changed

packages/portalnetwork/src/networks/network.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -367,19 +367,6 @@ export abstract class BaseNetwork extends EventEmitter {
367367

368368
handlePing = async (src: INodeAddress, id: bigint, pingMessage: PingMessage) => {
369369
if (!this.routingTable.getWithPending(src.nodeId)?.value) {
370-
if (
371-
pingMessage.payloadType !== PingPongPayloadExtensions.CLIENT_INFO_RADIUS_AND_CAPABILITIES
372-
) {
373-
const customPayload = ErrorPayload.serialize({
374-
errorCode: PingPongErrorCodes.EXTENSION_NOT_SUPPORTED,
375-
message: hexToBytes(
376-
fromAscii(
377-
`First PING message must be type 0: CLIENT_INFO_RADIUS_AND_CAPABILITIES. Received type ${pingMessage.payloadType}`,
378-
),
379-
),
380-
})
381-
return this.sendPong(src, id, customPayload, PingPongPayloadExtensions.ERROR_RESPONSE)
382-
}
383370
// Check to see if node is already in corresponding network routing table and add if not
384371
const enr = this.findEnr(src.nodeId)
385372
if (enr !== undefined) {

packages/portalnetwork/test/integration/pingpong.spec.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,6 @@ describe('PING/PONG', async () => {
6868
)
6969
}
7070
})
71-
it('should respond with ERROR_RESPONSE to type !== 0 PING from unknown node', async () => {
72-
const pingPayload = network1.pingPongPayload(PingPongPayloadExtensions.HISTORY_RADIUS_PAYLOAD)
73-
const pingMsg = {
74-
enrSeq: 1n,
75-
payloadType: PingPongPayloadExtensions.HISTORY_RADIUS_PAYLOAD,
76-
customPayload: pingPayload,
77-
}
78-
const network1NodeAddress: INodeAddress = {
79-
nodeId: node1.discv5.enr.nodeId,
80-
socketAddr: initMa,
81-
}
82-
const pong = await network2.handlePing(network1NodeAddress, 1234n, pingMsg)
83-
const pongMsg = PortalWireMessageType.deserialize(pong)
84-
// const pongPayload = HistoryRadius.deserialize(
85-
// (<any>pongMsg.value).customPayload,
86-
// )
87-
assert.equal((<any>pongMsg.value).payloadType, PingPongPayloadExtensions.ERROR_RESPONSE)
88-
})
8971
it('should exchange type 0 PING/PONG', async () => {
9072
const pingpong = await network1.sendPing(network2?.enr!.toENR(), 0)
9173
assert.exists(pingpong, 'should have received a pong')

0 commit comments

Comments
 (0)