Skip to content

Commit

Permalink
RPC fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottyPoi committed Aug 6, 2023
1 parent bd89152 commit f723168
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/cli/src/rpc/modules/portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,14 @@ export class portal {
this.logger(`historyRecursiveFindNodes request returned ${res}`)
return res ?? ''
}
async historyLocalContent(params: [string]): Promise<string> {
async historyLocalContent(params: [string]): Promise<string | undefined> {
const [contentKey] = params
this.logger(`Received historyLocalContent request for ${contentKey}`)

const res = await this._history.findContentLocally(fromHexString(contentKey))
this.logger(`historyLocalContent request returned ${res.length} bytes`)
return toHexString(res)
this.logger.extend(`historyLocalContent`)(`request returned ${res.length} bytes`)
this.logger.extend(`historyLocalContent`)(`${toHexString(res)}`)
return res.length > 0 ? toHexString(res) : undefined
}
async historyFindContent(params: [string, string]) {
const [enr, contentKey] = params
Expand Down Expand Up @@ -393,7 +394,7 @@ export class portal {
res.selector === 0 && this.logger.extend('findContent')('utp')
this.logger.extend('findContent')(content)
return {
content: toHexString(content),
content: content.length > 0 ? toHexString(content) : '',
utpTransfer: res.selector === 0,
}
}
Expand Down

0 comments on commit f723168

Please sign in to comment.