feat: chainstore: exit early in MaybeTakeHeavierTipset
This commit is contained in:
parent
9ae42929d7
commit
596b01fba2
@ -125,7 +125,7 @@ func (o *observer) listenHeadChangesOnce(ctx context.Context) error {
|
|||||||
|
|
||||||
for changes := range notifs {
|
for changes := range notifs {
|
||||||
if err := o.applyChanges(ctx, changes); err != nil {
|
if err := o.applyChanges(ctx, changes); err != nil {
|
||||||
return err
|
return xerrors.Errorf("failed to apply a change notification: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,6 +425,11 @@ func (cs *ChainStore) MaybeTakeHeavierTipSet(ctx context.Context, ts *types.TipS
|
|||||||
}
|
}
|
||||||
|
|
||||||
defer cs.heaviestLk.Unlock()
|
defer cs.heaviestLk.Unlock()
|
||||||
|
|
||||||
|
if ts.Equals(cs.heaviest) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
w, err := cs.weight(ctx, cs.StateBlockstore(), ts)
|
w, err := cs.weight(ctx, cs.StateBlockstore(), ts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user