From 4fc65a002d36675367e2c3eac7854dc83c248be8 Mon Sep 17 00:00:00 2001 From: NguyenNguyen Date: Tue, 29 Jan 2019 11:44:22 +0700 Subject: [PATCH] Using gas from flag --- cmd/tomo/config.go | 8 ++++++++ common/constants.go | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/tomo/config.go b/cmd/tomo/config.go index 59cc910972..dd86d3ac3c 100644 --- a/cmd/tomo/config.go +++ b/cmd/tomo/config.go @@ -162,6 +162,14 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, tomoConfig) { common.RollbackHash = common.HexToHash(rollbackHash) } + // Check GasPrice + common.MinGasPrice = common.DefaultMinGasPrice + if ctx.GlobalIsSet(utils.GasPriceFlag.Name) { + if gasPrice := int64(ctx.GlobalInt(utils.GasPriceFlag.Name)); gasPrice > common.DefaultMinGasPrice { + common.MinGasPrice = gasPrice + } + } + // read passwords from environment passwords := []string{} for _, env := range cfg.Account.Passwords { diff --git a/common/constants.go b/common/constants.go index 4f64c40ed6..480c9ecbba 100644 --- a/common/constants.go +++ b/common/constants.go @@ -16,7 +16,7 @@ const ( LimitPenaltyEpoch = 4 BlocksPerYear = uint64(15768000) LimitThresholdNonceInQueue = 10 - MinGasPrice = 2500 + DefaultMinGasPrice = 2500 MergeSignRange = 15 ) @@ -24,3 +24,4 @@ var TIP2019Block = big.NewInt(1050000) var IsTestnet bool = false var StoreRewardFolder string var RollbackHash Hash +var MinGasPrice int64