Skip to content

Commit

Permalink
fix params check logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruce authored and Bruce committed Sep 7, 2021
1 parent 0938965 commit ddaca8e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/wsrpc/src/puber/dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function dispatchRpc(chain: string, data: ReqDataT, resp: Http.Serv
case RpcTyp.Cacher:
if (Cacher.statusOk(chain)) {
let tmethod = method
if (method === 'chain_getBlockHash' && params === [0]) {
if (method === 'chain_getBlockHash' && (params?.length === 1 && params[0] === 0)) {
log.debug(`${chain} get rpc initial block hash`)
tmethod = `${method}_0`
}
Expand Down Expand Up @@ -88,7 +88,7 @@ export async function dispatchWs(chain: string, data: ReqDataT, puber: Puber, st
if (Cacher.statusOk(chain)) {// no need to clear puber.subid and suber.pubers
const res = { id, jsonrpc } as WsData
let tmethod = method
if (method === 'chain_getBlockHash' && params === [0]) {
if (method === 'chain_getBlockHash' && (params?.length === 1 && params[0] === 0)) {
log.debug(`${chain} get ws initial block hash`)
tmethod = `${method}_0`
}
Expand Down

0 comments on commit ddaca8e

Please sign in to comment.