lite2: improve auto update (#4334)

* lite2: advance to latest header

without any exponential steps

rename autoUpdate to autoUpdateRoutine

* lite2: wait in Cleanup until goroutines finished running
This commit is contained in:
Anton Kaliaev
2020-01-22 20:26:47 +04:00
committed by GitHub
parent f95409e070
commit 1905ef7ca8
4 changed files with 49 additions and 32 deletions
+9 -3
View File
@@ -63,11 +63,14 @@ func TestExample_Client_AutoUpdate(t *testing.T) {
if err != nil {
stdlog.Fatal(err)
}
defer c.Stop()
defer func() {
c.Stop()
c.Cleanup()
}()
time.Sleep(2 * time.Second)
h, err := c.TrustedHeader(3, time.Now())
h, err := c.TrustedHeader(0, time.Now())
if err != nil {
stdlog.Fatal(err)
}
@@ -122,7 +125,10 @@ func TestExample_Client_ManualUpdate(t *testing.T) {
if err != nil {
stdlog.Fatal(err)
}
defer c.Stop()
defer func() {
c.Stop()
c.Cleanup()
}()
_, err = c.VerifyHeaderAtHeight(3, time.Now())
if err != nil {