Skip to content

Commit

Permalink
initialize mpool ts _before_ loading local messages
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo committed Aug 25, 2020
1 parent a085b3b commit 7e81081
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions chain/messagepool/messagepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,7 @@ func New(api Provider, ds dtypes.MetadataDS, netName dtypes.NetworkName) (*Messa
// enable initial prunes
mp.pruneCooldown <- struct{}{}

if err := mp.loadLocal(); err != nil {
log.Errorf("loading local messages: %+v", err)
}

go mp.runLoop()

// load the current tipset and subscribe to head changes _before_ loading local messages
mp.curTs = api.SubscribeHeadChanges(func(rev, app []*types.TipSet) error {
err := mp.HeadChange(rev, app)
if err != nil {
Expand All @@ -204,6 +199,12 @@ func New(api Provider, ds dtypes.MetadataDS, netName dtypes.NetworkName) (*Messa
return err
})

if err := mp.loadLocal(); err != nil {
log.Errorf("loading local messages: %+v", err)
}

go mp.runLoop()

return mp, nil
}

Expand Down

0 comments on commit 7e81081

Please sign in to comment.