@@ -48,15 +48,6 @@ func toPortalRpcError(e: ref CatchableError): PortalRpcError =
4848 else :
4949 raiseAssert (e.msg)
5050
51- proc portal_historyLocalContent (
52- client: PortalRpcClient , contentKey: string
53- ): Future [Result [string , PortalRpcError ]] {.async : (raises: []).} =
54- try :
55- let content = await RpcClient (client).portal_historyLocalContent (contentKey)
56- ok (content)
57- except CatchableError as e:
58- err (e.toPortalRpcError ())
59-
6051proc portal_historyGetContent (
6152 client: PortalRpcClient , contentKey: string
6253): Future [Result [string , PortalRpcError ]] {.async : (raises: []).} =
@@ -78,17 +69,6 @@ template valueOrErr[T](res: Result[T, string], error: PortalRpcError): auto =
7869 else :
7970 err (error)
8071
81- proc historyGetContent (
82- client: PortalRpcClient , contentKey: string
83- ): Future [Result [string , PortalRpcError ]] {.async : (raises: []).} =
84- # Look up the content from the local db before trying to get it from the network
85- let content = (await client.portal_historyLocalContent (contentKey)).valueOr:
86- if error == ContentNotFound :
87- ? await client.portal_historyGetContent (contentKey)
88- else :
89- return err (error)
90- ok (content)
91-
9272proc historyGetBlockHeader * (
9373 client: PortalRpcClient , blockHash: Hash32 , validateContent = true
9474): Future [Result [Header , PortalRpcError ]] {.async : (raises: []).} =
@@ -104,7 +84,7 @@ proc historyGetBlockHeader*(
10484
10585 let
10686 contentKey = blockHeaderContentKey (blockHash).encode ().asSeq ().to0xHex ()
107- content = ? await client.historyGetContent (contentKey)
87+ content = ? await client.portal_historyGetContent (contentKey)
10888 headerWithProof = decodeSsz (content.toBytes (), BlockHeaderWithProof ).valueOr:
10989 return err (InvalidContentValue )
11090 headerBytes = headerWithProof.header.asSeq ()
@@ -124,7 +104,7 @@ proc historyGetBlockBody*(
124104
125105 let
126106 contentKey = blockBodyContentKey (blockHash).encode ().asSeq ().to0xHex ()
127- content = ? await client.historyGetContent (contentKey)
107+ content = ? await client.portal_historyGetContent (contentKey)
128108
129109 if validateContent:
130110 let blockHeader = ? await client.historyGetBlockHeader (blockHash)
@@ -144,7 +124,7 @@ proc historyGetReceipts*(
144124
145125 let
146126 contentKey = receiptsContentKey (blockHash).encode ().asSeq ().to0xHex ()
147- content = ? await client.historyGetContent (contentKey)
127+ content = ? await client.portal_historyGetContent (contentKey)
148128
149129 if validateContent:
150130 let blockHeader = ? await client.historyGetBlockHeader (blockHash)
0 commit comments