fix: update StatApplied when fvm apply message

This commit is contained in:
swift-mx 2022-04-24 11:50:54 +08:00
parent 2be9452ced
commit 6c40d363f5

View File

@ -3,6 +3,7 @@ package vm
import ( import (
"bytes" "bytes"
"context" "context"
"sync/atomic"
"time" "time"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
@ -294,6 +295,7 @@ func NewFVM(ctx context.Context, opts *VMOpts) (*FVM, error) {
func (vm *FVM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet, error) { func (vm *FVM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet, error) {
start := build.Clock.Now() start := build.Clock.Now()
defer atomic.AddUint64(&StatApplied, 1)
msgBytes, err := cmsg.VMMessage().Serialize() msgBytes, err := cmsg.VMMessage().Serialize()
if err != nil { if err != nil {
return nil, xerrors.Errorf("serializing msg: %w", err) return nil, xerrors.Errorf("serializing msg: %w", err)
@ -335,6 +337,7 @@ func (vm *FVM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet
func (vm *FVM) ApplyImplicitMessage(ctx context.Context, cmsg *types.Message) (*ApplyRet, error) { func (vm *FVM) ApplyImplicitMessage(ctx context.Context, cmsg *types.Message) (*ApplyRet, error) {
start := build.Clock.Now() start := build.Clock.Now()
defer atomic.AddUint64(&StatApplied, 1)
msgBytes, err := cmsg.VMMessage().Serialize() msgBytes, err := cmsg.VMMessage().Serialize()
if err != nil { if err != nil {
return nil, xerrors.Errorf("serializing msg: %w", err) return nil, xerrors.Errorf("serializing msg: %w", err)