Skip to content

Commit

Permalink
fix findContent integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottyPoi committed Aug 22, 2023
1 parent 3269d1a commit 082567c
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions packages/portalnetwork/test/integration/integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ tape('FindContent', async (t) => {
await addRLPSerializedBlock(testBlockData[29].rlp, testBlockData[29].blockHash, protocol1)
await protocol1.sendPing(protocol2?.enr!.toENR())

await protocol2.sendFindContent(
const res = await protocol2.sendFindContent(
node1.discv5.enr.nodeId,
fromHexString(
getContentKey(
Expand All @@ -213,27 +213,15 @@ tape('FindContent', async (t) => {
),
),
)
await new Promise((resolve) => {
protocol2.on('ContentAdded', async (key, contentType, content) => {
if (contentType === 0) {
const headerWithProof = BlockHeaderWithProof.deserialize(fromHexString(content))
const header = BlockHeader.fromRLPSerializedHeader(headerWithProof.header, {
setHardfork: true,
})
t.equal(
toHexString(header.hash()),
testBlockData[29].blockHash,
'retrieved expected header',
)
node2.removeAllListeners()
await node1.stop()
await node2.stop()
resolve(() => {
t.end()
})
}
})
const headerWithProof = BlockHeaderWithProof.deserialize(res!.value as Uint8Array)
const header = BlockHeader.fromRLPSerializedHeader(headerWithProof.header, {
setHardfork: true,
})
t.equal(toHexString(header.hash()), testBlockData[29].blockHash, 'retrieved expected header')
node2.removeAllListeners()
await node1.stop()
await node2.stop()
t.end()
})

tape('eth_getBlockByHash', async (t) => {
Expand Down

0 comments on commit 082567c

Please sign in to comment.