diff --git a/common/common.go b/common/common.go index 9b6cc81..d07ad9b 100644 --- a/common/common.go +++ b/common/common.go @@ -80,6 +80,7 @@ type ( Chain string Upgrades map[string]Upgradeinfo Blocks int + BestBlockHash string Consensus ConsensusInfo EstimatedHeight int } diff --git a/frontend/service.go b/frontend/service.go index 3dd2ee9..3a79db7 100644 --- a/frontend/service.go +++ b/frontend/service.go @@ -146,13 +146,16 @@ func (s *lwdStreamer) GetLatestBlock(ctx context.Context, placeholder *walletrpc var getblockchaininfoReply common.ZcashdRpcReplyGetblockchaininfo err := json.Unmarshal(result, &getblockchaininfoReply) if err != nil { - return nil, rpcErr + return nil, err + } + + hash, err := hex.DecodeString(getblockchaininfoReply.BestBlockHash) + if err != nil { + return nil, err } common.Metrics.LatestBlockCounter.Inc() - - // TODO: also return block hashes here - return &walletrpc.BlockID{Height: uint64(getblockchaininfoReply.Blocks)}, nil + return &walletrpc.BlockID{Height: uint64(getblockchaininfoReply.Blocks), Hash: parser.Reverse(hash)}, nil } // GetTaddressTxids is a streaming RPC that returns transaction IDs that have