cr feedback

This commit is contained in:
William Banfield
2021-08-18 17:47:30 -04:00
parent 885b78698c
commit 1f2ba5a87d
9 changed files with 103 additions and 93 deletions
+12 -4
View File
@@ -26,11 +26,13 @@ type Server struct {
}
// Routes returns the set of routes used by the Inspect server.
func Routes(s state.Store, bs state.BlockStore, es []indexer.EventSink) core.RoutesMap {
func Routes(cfg config.RPCConfig, s state.Store, bs state.BlockStore, es []indexer.EventSink) core.RoutesMap {
env := &core.Environment{
EventSinks: es,
StateStore: s,
BlockStore: bs,
Config: cfg,
EventSinks: es,
StateStore: s,
BlockStore: bs,
WaitSyncChecker: waitSyncCheckerImpl{},
}
return core.RoutesMap{
"blockchain": server.NewRPCFunc(env.BlockchainInfo, "minHeight,maxHeight", true),
@@ -85,6 +87,12 @@ func addCORSHandler(rpcConfig *config.RPCConfig, h http.Handler) http.Handler {
return h
}
type waitSyncCheckerImpl struct{}
func (_ waitSyncCheckerImpl) WaitSync() bool {
return false
}
// ListenAndServe listens on the address specified in srv.Addr and handles any
// incoming requests over HTTP using the Inspect rpc handler specified on the server.
func (srv *Server) ListenAndServe(ctx context.Context) error {