Skip to content

Commit

Permalink
CLI: add portal_stateGossip to rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottyPoi committed Oct 25, 2023
1 parent f2ce866 commit 31a18db
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/cli/src/rpc/modules/portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const methods = [
'portal_stateRoutingTableInfo',
'portal_stateStore',
'portal_stateLocalContent',
'portal_stateGossip',
// history
'portal_historyRoutingTableInfo',
'portal_historyAddEnr',
Expand Down Expand Up @@ -158,6 +159,10 @@ export class portal {
[validators.contentKey],
[validators.hex],
])
this.stateGossip = middleware(this.stateGossip.bind(this), 2, [
[validators.hex],
[validators.hex],
])
this.beaconSendFindContent = middleware(this.beaconSendFindContent.bind(this), 2, [
[validators.dstId],
[validators.hex],
Expand Down Expand Up @@ -605,6 +610,12 @@ export class portal {
const res = await this._history.gossipContent(fromHexString(contentKey), fromHexString(content))
return res
}
async stateGossip(params: [string, string]) {
const [contentKey, content] = params
this.logger(`stateGossip request received for ${contentKey}`)
const res = await this._state.gossipContent(fromHexString(contentKey), fromHexString(content))
return res
}
async historyStore(params: [string, string]) {
const [contentKey, content] = params.map((param) => fromHexString(param))
try {
Expand Down

0 comments on commit 31a18db

Please sign in to comment.