Skip to content

Commit

Permalink
Client: get checkpoints by named witness
Browse files Browse the repository at this point in the history
This is useful for seeing what's going on with a specific witness, and is likely to be used to witness operators for a smug momemt of pride.
  • Loading branch information
mhutchinson committed Oct 23, 2024
1 parent e399c09 commit f4f3019
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
var (
baseURL = flag.String("base_url", "https://api.transparency.dev", "The base URL of the distributor")
n = flag.Uint("n", 2, "The desired number of witness signatures for each log")
witness = flag.String("witness", "", "The name of a specific witness to fetch the latest checkpoints for. If specified, --n is ignored.")
)

func main() {
Expand All @@ -58,7 +59,13 @@ func main() {
continue
}
fmt.Printf("Log %q (%s)\n", log.Verifier.Name(), l)
cp, err := d.GetCheckpointN(l, *n)
var cp []byte
var err error
if len(*witness) > 0 {
cp, err = d.GetCheckpointWitness(l, *witness)
} else {
cp, err = d.GetCheckpointN(l, *n)
}
if err != nil {
fmt.Printf("❌️ Could not get checkpoint.%d: %v\n", *n, err)
continue
Expand Down

0 comments on commit f4f3019

Please sign in to comment.