mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-28 14:17:17 +00:00
62c25eaedb
* Revert "Fix `ListValidatorBalances` for v0.11 (#5458)" This reverts commit3763a8ce5d
. * Revert "Deprecate archival service (#5445)" This reverts commit4fbcedf541
. * Revert "Delete archival DB methods (#5459)" This reverts commit8a3ea1e936
. * Revert "Modify `ListBeaconCommittees ` to use new state service (#5411)" This reverts commit497fa6ed50
. * Revert "Modify `GetValidatorParticipation` to use new state service (#5409)" This reverts commit046a00aa87
. * Revert "Modify `GetValidatorActiveSetChanges` to use new state service (#5408)" This reverts commit5eb6485e14
. * Revert "Modify `ListValidatorAssignments` to use new state service (#5365)" This reverts commit5a1a768135
.
75 lines
1.9 KiB
Go
75 lines
1.9 KiB
Go
package flags
|
|
|
|
import (
|
|
"github.com/prysmaticlabs/prysm/shared/cmd"
|
|
log "github.com/sirupsen/logrus"
|
|
"gopkg.in/urfave/cli.v2"
|
|
)
|
|
|
|
// GlobalFlags specifies all the global flags for the
|
|
// beacon node.
|
|
type GlobalFlags struct {
|
|
EnableArchive bool
|
|
EnableArchivedValidatorSetChanges bool
|
|
EnableArchivedBlocks bool
|
|
EnableArchivedAttestations bool
|
|
UnsafeSync bool
|
|
DisableDiscv5 bool
|
|
MinimumSyncPeers int
|
|
MaxPageSize int
|
|
DeploymentBlock int
|
|
}
|
|
|
|
var globalConfig *GlobalFlags
|
|
|
|
// Get retrieves the global config.
|
|
func Get() *GlobalFlags {
|
|
if globalConfig == nil {
|
|
return &GlobalFlags{}
|
|
}
|
|
return globalConfig
|
|
}
|
|
|
|
// Init sets the global config equal to the config that is passed in.
|
|
func Init(c *GlobalFlags) {
|
|
globalConfig = c
|
|
}
|
|
|
|
// ConfigureGlobalFlags initializes the global config.
|
|
// based on the provided cli context.
|
|
func ConfigureGlobalFlags(ctx *cli.Context) {
|
|
cfg := &GlobalFlags{}
|
|
if ctx.Bool(ArchiveEnableFlag.Name) {
|
|
cfg.EnableArchive = true
|
|
}
|
|
if ctx.Bool(ArchiveValidatorSetChangesFlag.Name) {
|
|
cfg.EnableArchivedValidatorSetChanges = true
|
|
}
|
|
if ctx.Bool(ArchiveBlocksFlag.Name) {
|
|
cfg.EnableArchivedBlocks = true
|
|
}
|
|
if ctx.Bool(ArchiveAttestationsFlag.Name) {
|
|
cfg.EnableArchivedAttestations = true
|
|
}
|
|
if ctx.Bool(UnsafeSync.Name) {
|
|
cfg.UnsafeSync = true
|
|
}
|
|
if ctx.Bool(DisableDiscv5.Name) {
|
|
cfg.DisableDiscv5 = true
|
|
}
|
|
cfg.MaxPageSize = ctx.Int(RPCMaxPageSize.Name)
|
|
cfg.DeploymentBlock = ctx.Int(ContractDeploymentBlock.Name)
|
|
configureMinimumPeers(ctx, cfg)
|
|
|
|
Init(cfg)
|
|
}
|
|
|
|
func configureMinimumPeers(ctx *cli.Context, cfg *GlobalFlags) {
|
|
cfg.MinimumSyncPeers = ctx.Int(MinSyncPeers.Name)
|
|
maxPeers := int(ctx.Int64(cmd.P2PMaxPeers.Name))
|
|
if cfg.MinimumSyncPeers > maxPeers {
|
|
log.Warnf("Changing Minimum Sync Peers to %d", maxPeers)
|
|
cfg.MinimumSyncPeers = maxPeers
|
|
}
|
|
}
|