multi: add GetBlockHeader to BlockChainIO

This commit is contained in:
Jonathan Harvey-Buschel
2023-10-26 12:09:56 -04:00
committed by Olaoluwa Osuntokun
parent 35bfd27467
commit b04927f688
7 changed files with 61 additions and 0 deletions

View File

@@ -45,6 +45,24 @@ func (h *HarnessRPC) GetBlock(
return resp
}
// GetBlockHeader makes an RPC call to chain kit client's GetBlockHeader and
// asserts.
func (h *HarnessRPC) GetBlockHeader(
req *chainrpc.GetBlockHeaderRequest) *chainrpc.GetBlockHeaderResponse {
if req == nil {
req = &chainrpc.GetBlockHeaderRequest{}
}
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
resp, err := h.ChainKit.GetBlockHeader(ctxt, req)
h.NoError(err, "GetBlockHeader")
return resp
}
// GetBlockHash makes an RPC call to chain kit client's GetBlockHash and
// asserts.
func (h *HarnessRPC) GetBlockHash(