Skip to content

Commit

Permalink
feat: register the gRPC block API
Browse files Browse the repository at this point in the history
  • Loading branch information
rach-id committed Oct 9, 2024
1 parent 8c98dec commit 0cd3620
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
6 changes: 6 additions & 0 deletions server/grpc/server.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package grpc

import (
"context"
"fmt"
coregrpc "github.com/tendermint/tendermint/rpc/grpc"
"net"
"time"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0cd3620

Please sign in to comment.