mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 07:58:22 -05:00
* Calculate max epoch and churn for slashing once
* calculate once for proposer and attester slashings
* changelog <3
* introduce struct
* check if err is nil in ProcessVoluntaryExits
* rename exitData to exitInfo and return from functions
* cleanup + tests
* cleanup after rebase
* Potuz's review
* pre-calculate total active balance
* remove `slashValidatorFunc` closure
* Avoid a second validator loop
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* remove balance parameter from slashing functions
---------
Co-authored-by: terence tsao <terence@prysmaticlabs.com>
Co-authored-by: potuz <potuz@prysmaticlabs.com>
44 lines
972 B
Go
44 lines
972 B
Go
package httprest
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/OffchainLabs/prysm/v6/api/server/middleware"
|
|
)
|
|
|
|
// Option is a http rest server functional parameter type.
|
|
type Option func(g *Server) error
|
|
|
|
// WithMiddlewares sets the list of middlewares to be applied on routes.
|
|
func WithMiddlewares(mw []middleware.Middleware) Option {
|
|
return func(g *Server) error {
|
|
g.cfg.middlewares = mw
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithHTTPAddr sets the full address ( host and port ) of the server.
|
|
func WithHTTPAddr(addr string) Option {
|
|
return func(g *Server) error {
|
|
g.cfg.httpAddr = addr
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithRouter sets the internal router of the server, this is required.
|
|
func WithRouter(r *http.ServeMux) Option {
|
|
return func(g *Server) error {
|
|
g.cfg.router = r
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithTimeout allows changing the timeout value for API calls.
|
|
func WithTimeout(duration time.Duration) Option {
|
|
return func(g *Server) error {
|
|
g.cfg.timeout = duration
|
|
return nil
|
|
}
|
|
}
|