Merge pull request #365 from filecoin-project/fix/panic-chainat
Fix panic if there is a panic in the hanlder function
This commit is contained in:
commit
b2603c801b
@ -121,8 +121,8 @@ func (e *heightEvents) headChangeAt(rev, app []*types.TipSet) error {
|
|||||||
//
|
//
|
||||||
// ts passed to handlers is the tipset at the specified, or above, if lower tipsets were null
|
// ts passed to handlers is the tipset at the specified, or above, if lower tipsets were null
|
||||||
func (e *heightEvents) ChainAt(hnd HeightHandler, rev RevertHandler, confidence int, h uint64) error {
|
func (e *heightEvents) ChainAt(hnd HeightHandler, rev RevertHandler, confidence int, h uint64) error {
|
||||||
e.lk.Lock()
|
|
||||||
defer e.lk.Unlock()
|
e.lk.Lock() // Tricky locking, check your locks if you modify this function!
|
||||||
|
|
||||||
bestH := e.tsc.best().Height()
|
bestH := e.tsc.best().Height()
|
||||||
|
|
||||||
@ -140,6 +140,8 @@ func (e *heightEvents) ChainAt(hnd HeightHandler, rev RevertHandler, confidence
|
|||||||
bestH = e.tsc.best().Height()
|
bestH = e.tsc.best().Height()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer e.lk.Unlock()
|
||||||
|
|
||||||
if bestH >= h+uint64(confidence)+e.gcConfidence {
|
if bestH >= h+uint64(confidence)+e.gcConfidence {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user