"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"
// 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
}