X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=blockchain%2Ftxbuilder%2Ffinalize.go;fp=blockchain%2Ftxbuilder%2Ffinalize.go;h=577830fea7b3b89e39f101964a334c8e36f3f84f;hb=33e6164539b4a8951d23d7f2f5803ca394273428;hp=a8e002a25413ac97cd84968fcead4ae41353e05c;hpb=c077532c081128210382055fbc0726a38b9f4be0;p=bytom%2Fvapor.git diff --git a/blockchain/txbuilder/finalize.go b/blockchain/txbuilder/finalize.go index a8e002a2..577830fe 100644 --- a/blockchain/txbuilder/finalize.go +++ b/blockchain/txbuilder/finalize.go @@ -4,9 +4,10 @@ import ( "bytes" "context" - "github.com/vapor/common/compute" + "github.com/vapor/common/arithmetic" cfg "github.com/vapor/config" "github.com/vapor/errors" + "github.com/vapor/math/checked" "github.com/vapor/protocol" "github.com/vapor/protocol/bc/types" "github.com/vapor/protocol/vm" @@ -31,7 +32,9 @@ var ( // assembles a fully signed tx, and stores the effects of // its changes on the UTXO set. func FinalizeTx(ctx context.Context, c *protocol.Chain, tx *types.Tx) error { - if fee := compute.CalculateTxFee(tx); fee > cfg.CommonConfig.Wallet.MaxTxFee { + if fee, err := arithmetic.CalculateTxFee(tx); err != nil { + return checked.ErrOverflow + } else if fee > cfg.CommonConfig.Wallet.MaxTxFee { return ErrExtTxFee }