MCPcopy Index your code
hub / github.com/chain/Core / leaderSignHandler

Method leaderSignHandler

core/api.go:334–346  ·  view source on GitHub ↗
(f func(context.Context, *legacy.Block) ([]byte, error))

Source from the content-addressed store, hash-verified

332}
333
334func (a *API) leaderSignHandler(f func(context.Context, *legacy.Block) ([]byte, error)) func(context.Context, *legacy.Block) ([]byte, error) {
335 return func(ctx context.Context, b *legacy.Block) ([]byte, error) {
336 if f == nil {
337 return nil, errNotFound // TODO(kr): is this really the right error here?
338 }
339 if a.leader.State() == leader.Leading {
340 return f(ctx, b)
341 }
342 var resp []byte
343 err := a.forwardToLeader(ctx, "/rpc/signer/sign-block", b, &resp)
344 return resp, err
345 }
346}
347
348// forwardToLeader forwards the current request to the core's leader
349// process. It propagates the same credentials used in the current

Callers 1

buildHandlerMethod · 0.95

Calls 3

forwardToLeaderMethod · 0.95
fFunction · 0.85
StateMethod · 0.65

Tested by

no test coverage detected