fix ordering of block applies in reorg ops
This commit is contained in:
parent
eeec3c1783
commit
ccfa03138d
@ -70,9 +70,8 @@ func (e *heightEvents) headChangeAt(rev, app []*types.TipSet) error {
|
||||
}
|
||||
}
|
||||
|
||||
tail := len(app) - 1
|
||||
for i := range app {
|
||||
ts := app[tail-i]
|
||||
ts := app[i]
|
||||
|
||||
if err := e.tsc.add(ts); err != nil {
|
||||
return err
|
||||
|
@ -254,6 +254,13 @@ func (cs *ChainStore) reorgWorker(ctx context.Context) chan<- reorg {
|
||||
log.Error("computing reorg ops failed: ", err)
|
||||
continue
|
||||
}
|
||||
|
||||
// reverse the apply array
|
||||
for i := len(apply)/2 - 1; i >= 0; i-- {
|
||||
opp := len(apply) - 1 - i
|
||||
apply[i], apply[opp] = apply[opp], apply[i]
|
||||
}
|
||||
|
||||
for _, hcf := range cs.headChangeNotifs {
|
||||
if err := hcf(revert, apply); err != nil {
|
||||
log.Error("head change func errored (BAD): ", err)
|
||||
|
Loading…
Reference in New Issue
Block a user