diff --git a/src/lib/waku_store/index.ts b/src/lib/waku_store/index.ts index e2e462a94f..35e1e4da35 100644 --- a/src/lib/waku_store/index.ts +++ b/src/lib/waku_store/index.ts @@ -7,6 +7,7 @@ import { Peer } from "libp2p/src/peer-store"; import PeerId from "peer-id"; import * as protoV2Beta4 from "../../proto/store_v2beta4"; +import { HistoryResponse } from "../../proto/store_v2beta4"; import { DefaultPubSubTopic, StoreCodecs } from "../constants"; import { getPeersForProtocol, selectRandomPeer } from "../select_peer"; import { hexToBytes } from "../utils"; @@ -14,6 +15,8 @@ import { DecryptionMethod, WakuMessage } from "../waku_message"; import { HistoryRPC, PageDirection } from "./history_rpc"; +import Error = HistoryResponse.Error; + const dbg = debug("waku:store"); export const DefaultPageSize = 10; @@ -218,7 +221,8 @@ export class WakuStore { const response = reply.response as protoV2Beta4.HistoryResponse; - if (response.error) { + console.log("Response", response); + if (response.error && response.error !== Error.ERROR_NONE_UNSPECIFIED) { throw "History response contains an Error: " + response.error; }