Make state transition in validation async
This commit is contained in:
parent
0c1c19c6ef
commit
e53aee26a3
@ -788,7 +788,7 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) (er
|
|||||||
b.Header.ParentWeight, pweight)
|
b.Header.ParentWeight, pweight)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stuff that needs stateroot / worker address
|
stateRootCheck := async.Err(func() error {
|
||||||
stateroot, precp, err := syncer.sm.TipSetState(ctx, baseTs)
|
stateroot, precp, err := syncer.sm.TipSetState(ctx, baseTs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("get tipsetstate(%d, %s) failed: %w", h.Height, h.Parents, err)
|
return xerrors.Errorf("get tipsetstate(%d, %s) failed: %w", h.Height, h.Parents, err)
|
||||||
@ -813,6 +813,10 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) (er
|
|||||||
return xerrors.Errorf("parent receipts root did not match computed value (%s != %s)", precp, h.ParentMessageReceipts)
|
return xerrors.Errorf("parent receipts root did not match computed value (%s != %s)", precp, h.ParentMessageReceipts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
// Stuff that needs worker address
|
||||||
waddr, err := stmgr.GetMinerWorkerRaw(ctx, syncer.sm, lbst, h.Miner)
|
waddr, err := stmgr.GetMinerWorkerRaw(ctx, syncer.sm, lbst, h.Miner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("GetMinerWorkerRaw failed: %w", err)
|
return xerrors.Errorf("GetMinerWorkerRaw failed: %w", err)
|
||||||
@ -933,6 +937,7 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) (er
|
|||||||
winnerCheck,
|
winnerCheck,
|
||||||
msgsCheck,
|
msgsCheck,
|
||||||
baseFeeCheck,
|
baseFeeCheck,
|
||||||
|
stateRootCheck,
|
||||||
}
|
}
|
||||||
|
|
||||||
var merr error
|
var merr error
|
||||||
|
Loading…
Reference in New Issue
Block a user