Skip to content

Commit

Permalink
Properly process all beacons when self-signing (#1275)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnomalRoil authored and CluEleSsUK committed Jan 9, 2024
1 parent 10766aa commit 90f1986
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions internal/drand-cli/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,20 +314,23 @@ func printJSON(w io.Writer, j interface{}) error {
}

func selfSign(c *cli.Context, l log.Logger) error {
stores, err := getKeyStores(c, l)
conf := contextToConfig(c, l)
stores, err := key.NewFileStores(conf.ConfigFolderMB())
if err != nil {
return fmt.Errorf("drand: err reading beacons database: %w", err)
}

l.Infow("Detected stores", "amount", len(stores))

for beaconID, fs := range stores {
pair, err := fs.LoadKeyPair()

if err != nil {
return fmt.Errorf("beacon id [%s] - loading private/public: %w", beaconID, err)
return fmt.Errorf("beacon id [%s] - error loading private/public: %w", beaconID, err)
}
if pair.Public.ValidSignature() == nil {
fmt.Fprintf(c.App.Writer, "beacon id [%s] - public identity already self signed.\n", beaconID)
return nil
continue
}

if err := pair.SelfSign(); err != nil {
Expand Down

0 comments on commit 90f1986

Please sign in to comment.