lotus-provider: fix RPC construction
This commit is contained in:
parent
0c866e08cb
commit
ae67cbdb4d
@ -41,8 +41,8 @@ func PermissionedWorkerAPI(a Worker) Worker {
|
|||||||
return &out
|
return &out
|
||||||
}
|
}
|
||||||
|
|
||||||
func PermissionedAPI[T any](a T) T {
|
func PermissionedAPI[T, P any](a T) P {
|
||||||
var out T
|
var out P
|
||||||
permissionedProxies(a, &out)
|
permissionedProxies(a, &out)
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,9 @@ func LotusProviderHandler(
|
|||||||
readerHandler, readerServerOpt := rpcenc.ReaderParamDecoder()
|
readerHandler, readerServerOpt := rpcenc.ReaderParamDecoder()
|
||||||
rpcServer := jsonrpc.NewServer(jsonrpc.WithServerErrors(api.RPCErrors), readerServerOpt)
|
rpcServer := jsonrpc.NewServer(jsonrpc.WithServerErrors(api.RPCErrors), readerServerOpt)
|
||||||
|
|
||||||
wapi := proxy.MetricedAPI(a)
|
wapi := proxy.MetricedAPI[api.LotusProvider, api.LotusProviderStruct](a)
|
||||||
if permissioned {
|
if permissioned {
|
||||||
wapi = api.PermissionedAPI(wapi)
|
wapi = api.PermissionedAPI[api.LotusProvider, api.LotusProviderStruct](wapi)
|
||||||
}
|
}
|
||||||
|
|
||||||
rpcServer.Register("Filecoin", wapi)
|
rpcServer.Register("Filecoin", wapi)
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/metrics"
|
"github.com/filecoin-project/lotus/metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
func MetricedAPI[T any](a T) T {
|
func MetricedAPI[T, P any](a T) P {
|
||||||
var out T
|
var out P
|
||||||
proxy(a, &out)
|
proxy(a, &out)
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user