Honour --quiet flag in block info command.

This commit is contained in:
Jim McDonald
2023-07-02 17:58:26 +02:00
parent 6f0f3e4c91
commit a7da10360e
2 changed files with 8 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ import (
"context"
"encoding/json"
"fmt"
"os"
"time"
eth2client "github.com/attestantio/go-eth2-client"
@@ -67,8 +68,14 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) {
return nil, errors.Wrap(err, "failed to obtain beacon block")
}
if signedBlock == nil {
if data.quiet {
os.Exit(1)
}
return nil, errors.New("empty beacon block")
}
if data.quiet {
os.Exit(0)
}
switch signedBlock.Version {
case spec.DataVersionPhase0: