"bytes"
"context"
+ cfg "github.com/bytom/config"
"github.com/bytom/consensus"
"github.com/bytom/errors"
"github.com/bytom/protocol"
// 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 {
- // maxTxFee means max transaction fee, maxTxFee = 0.4BTM * 25 = 10BTM
- maxTxFee := consensus.MaxGasAmount * consensus.VMGasRate * 25
- if fee := calculateTxFee(tx); fee > uint64(maxTxFee) {
+ if fee := calculateTxFee(tx); fee > cfg.CommonConfig.Wallet.MaxTxFee {
return ErrExtTxFee
}
"time"
)
+var (
+ // CommonConfig means config object
+ CommonConfig *Config
+)
+
type Config struct {
// Top level options use an anonymous struct
BaseConfig `mapstructure:",squash"`
//-----------------------------------------------------------------------------
type WalletConfig struct {
- Disable bool `mapstructure:"disable"`
- Rescan bool `mapstructure:"rescan"`
+ Disable bool `mapstructure:"disable"`
+ Rescan bool `mapstructure:"rescan"`
+ MaxTxFee uint64 `mapstructure:"max_tx_fee"`
}
type RPCAuthConfig struct {
// Default configurable wallet parameters.
func DefaultWalletConfig() *WalletConfig {
return &WalletConfig{
- Disable: false,
- Rescan: false,
+ Disable: false,
+ Rescan: false,
+ MaxTxFee: uint64(1000000000),
}
}
}
initLogFile(config)
initActiveNetParams(config)
+ initCommonConfig(config)
+
// Get store
coreDB := dbm.NewDB("core", config.DBBackend, config.DBDir())
store := leveldb.NewStore(coreDB)
}
+func initCommonConfig(config *cfg.Config) {
+ cfg.CommonConfig = config
+}
+
// Lanch web broser or not
func launchWebBrowser(port string) {
webAddress := webHost + ":" + port