diff --git a/chain/vm/vm.go b/chain/vm/vm.go index 15119b64c..3f240b369 100644 --- a/chain/vm/vm.go +++ b/chain/vm/vm.go @@ -300,10 +300,6 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet, } st := vm.cstate - if err := st.Snapshot(ctx); err != nil { - return nil, xerrors.Errorf("snapshot failed: %w", err) - } - defer st.ClearSnapshot() fromActor, err := st.GetActor(msg.From) if err != nil { @@ -345,6 +341,11 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet, fromActor.Nonce++ + if err := st.Snapshot(ctx); err != nil { + return nil, xerrors.Errorf("snapshot failed: %w", err) + } + defer st.ClearSnapshot() + ret, actorErr, rt := vm.send(ctx, msg, nil, msgGasCost) {