lite2: indicate success/failure of Update (#4536)

error itself is not enough since it only signals if there were any
errors. Either (types.SignedHeader) or (success bool) is needed to
indicate the status of the operation. Returning a header is optimal
since most of the clients will want to get a newly verified header
anyway.
This commit is contained in:
Anton Kaliaev
2020-03-06 17:10:28 +04:00
committed by GitHub
parent 431618cef6
commit d3f965ba68
5 changed files with 25 additions and 32 deletions

View File

@@ -73,17 +73,12 @@ func ExampleClient_Update() {
// monotonic component (see types/time/time.go) b) single instance is being
// run.
// https://github.com/tendermint/tendermint/issues/4489
err = c.Update(time.Now().Add(30 * time.Minute))
h, err := c.Update(time.Now().Add(30 * time.Minute))
if err != nil {
stdlog.Fatal(err)
}
h, err := c.TrustedHeader(0)
if err != nil {
stdlog.Fatal(err)
}
if h.Height > 2 {
if h != nil && h.Height > 2 {
fmt.Println("successful update")
} else {
fmt.Println("update failed")