remove notifee after subscribing

This commit is contained in:
vyzo
2020-09-07 15:55:53 +03:00
parent 05740e0f64
commit 4f0ab4f226
2 changed files with 29 additions and 9 deletions
+1 -6
View File
@@ -89,12 +89,7 @@ func waitForSync(stmgr *stmgr.StateManager, blocks int, subscribe func()) {
}
// we are not synced, subscribe to head changes and wait for sync
subscribed := false
stmgr.ChainStore().SubscribeHeadChanges(func(rev, app []*types.TipSet) error {
if subscribed {
return nil
}
if len(app) == 0 {
return nil
}
@@ -110,7 +105,7 @@ func waitForSync(stmgr *stmgr.StateManager, blocks int, subscribe func()) {
now := uint64(build.Clock.Now().UnixNano())
if latest > now-nearsync {
subscribe()
subscribed = true
return store.ErrNotifieeDone
}
return nil