From ddaca8ef03053fdbe6e9b16a234478b341d959b2 Mon Sep 17 00:00:00 2001 From: Bruce Date: Tue, 7 Sep 2021 14:48:03 +0800 Subject: [PATCH] fix params check logic --- packages/wsrpc/src/puber/dispatch.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/wsrpc/src/puber/dispatch.ts b/packages/wsrpc/src/puber/dispatch.ts index 18aaf27..8759081 100644 --- a/packages/wsrpc/src/puber/dispatch.ts +++ b/packages/wsrpc/src/puber/dispatch.ts @@ -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` } @@ -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` }