From 0cd36203b354fcfc4841454353621f33ed5b72f8 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Wed, 9 Oct 2024 12:08:49 +0400 Subject: [PATCH] feat: register the gRPC block API --- go.mod | 5 ++--- go.sum | 1 + server/grpc/server.go | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5b0cdb1fc4f9..11af2c4feefa 100644 --- a/go.mod +++ b/go.mod @@ -72,7 +72,7 @@ require ( github.com/aws/aws-sdk-go v1.40.45 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect - github.com/celestiaorg/nmt v0.22.1 // indirect + github.com/celestiaorg/nmt v0.22.2 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -184,8 +184,7 @@ replace ( // replace broken goleveldb. github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // use cometbft - github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.42.0-tm-v0.34.35 -) + github.com/tendermint/tendermint => // TODO use version after core is released retract ( // revert fix https://github.com/cosmos/cosmos-sdk/pull/16331 diff --git a/go.sum b/go.sum index 412cdcabfb69..01f79c72c1ff 100644 --- a/go.sum +++ b/go.sum @@ -147,6 +147,7 @@ github.com/celestiaorg/celestia-core v1.42.0-tm-v0.34.35 h1:bWy5XOgeuuSLe0Lc/htL github.com/celestiaorg/celestia-core v1.42.0-tm-v0.34.35/go.mod h1:/fK0n3ps09t5uErBQe1QZbrE81L81MNUzWpFyWQLDT0= github.com/celestiaorg/nmt v0.22.1 h1:t7fqoP5MJ8mBns5DB2XjfcPxQpS3CKMkY+v+BEkDxYc= github.com/celestiaorg/nmt v0.22.1/go.mod h1:ia/EpCk0enD5yO5frcxoNoFToz2Ghtk2i+blmCRjIY8= +github.com/celestiaorg/nmt v0.22.2/go.mod h1:/7huDiSRL/d2EGhoiKctgSzmLOJoWG8yEfbFtY1+Mow= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= diff --git a/server/grpc/server.go b/server/grpc/server.go index 78a8e1955af5..8a7666b3a077 100644 --- a/server/grpc/server.go +++ b/server/grpc/server.go @@ -1,7 +1,9 @@ package grpc import ( + "context" "fmt" + coregrpc "github.com/tendermint/tendermint/rpc/grpc" "net" "time" @@ -34,6 +36,10 @@ func StartGRPCServer(clientCtx client.Context, app types.Application, cfg config grpc.MaxRecvMsgSize(maxRecvMsgSize), ) + api := coregrpc.NewBlockAPI() + go api.StartNewBlockEventListener(context.Background()) + coregrpc.RegisterBlockAPIServer(grpcSrv, api) + app.RegisterGRPCServer(grpcSrv) // Reflection allows consumers to build dynamic clients that can write to any