rpc: consolidate RPC route map construction (#7582)

Define interfaces for the various methods a service may implement.  This is
basically just the set of things on Environment that are exported as RPCs, but
these are also implemented by the light proxy.

* internal/rpc: use NewRoutesMap to construct routes on service start
* light/proxy: use NewRoutesMap to construct RPC routes
This commit is contained in:
M. J. Fromberger
2022-01-13 10:45:36 -08:00
committed by GitHub
parent cef17e1c02
commit 81ee41228a
4 changed files with 122 additions and 328 deletions
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"net/http"
tmpubsub "github.com/tendermint/tendermint/internal/pubsub"
rpccore "github.com/tendermint/tendermint/internal/rpc/core"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/light"
lrpc "github.com/tendermint/tendermint/light/rpc"
@@ -90,7 +91,7 @@ func (p *Proxy) listen(ctx context.Context) (net.Listener, *http.ServeMux, error
mux := http.NewServeMux()
// 1) Register regular routes.
r := RPCRoutes(p.Client)
r := rpccore.NewRoutesMap(proxyService{Client: p.Client}, nil)
rpcserver.RegisterRPCFuncs(mux, r, p.Logger)
// 2) Allow websocket connections.