Skip to content

Commit cad06c0

Browse files
committed
go/oasis-node/cmd: Add node mode and entity verification
1 parent f89dcbc commit cad06c0

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

go/oasis-node/cmd/node/node.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,20 @@ func NewNode() (node *Node, err error) { // nolint: gocyclo
479479
}
480480
node.EntityID = entityID
481481

482+
requiresEntity := config.GlobalConfig.Consensus.Validator
483+
switch config.GlobalConfig.Mode {
484+
case config.ModeValidator, config.ModeCompute, config.ModeKeyManager, config.ModeObserver:
485+
requiresEntity = true
486+
}
487+
488+
if requiresEntity && entityID == nil {
489+
return nil, fmt.Errorf("node has no entity configured but expects one")
490+
}
491+
492+
if config.GlobalConfig.Mode == config.ModeClient && entityID != nil {
493+
return nil, fmt.Errorf("client node must not have entity configured, try using observer mode instead")
494+
}
495+
482496
// Load configured values for all registered crash points.
483497
crash.LoadViperArgValues()
484498

0 commit comments

Comments
 (0)