From 68dbddadc065c04e2177f2faa759395901973c19 Mon Sep 17 00:00:00 2001 From: parmarrushabh Date: Fri, 7 Dec 2018 10:56:50 +0530 Subject: [PATCH] Using gas from flag --- cmd/XDC/config.go | 22 +++++++++++++++------- common/constants.go | 5 +++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/cmd/XDC/config.go b/cmd/XDC/config.go index 0c99e80289..c559dffd61 100644 --- a/cmd/XDC/config.go +++ b/cmd/XDC/config.go @@ -28,6 +28,7 @@ import ( "unicode" "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/dashboard" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/internal/debug" @@ -36,7 +37,6 @@ import ( "github.com/ethereum/go-ethereum/params" whisper "github.com/ethereum/go-ethereum/whisper/whisperv6" "github.com/naoina/toml" - "github.com/ethereum/go-ethereum/common" ) var ( @@ -154,15 +154,23 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) { // Check testnet is enable. if ctx.GlobalBool(utils.XDCTestnetFlag.Name) { - common.IsTestnet = true + common.IsTestnet = true } - // Check rollback hash exist. - if rollbackHash := ctx.GlobalString(utils.RollbackFlag.Name); rollbackHash != "" { - common.RollbackHash = common.HexToHash(rollbackHash) + // Check rollback hash exist. + if rollbackHash := ctx.GlobalString(utils.RollbackFlag.Name); rollbackHash != "" { + 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 enviroment + } + + // read passwords from environment passwords := []string{} for _, env := range cfg.Account.Passwords { if trimmed := strings.TrimSpace(env); trimmed != "" { diff --git a/common/constants.go b/common/constants.go index d0be56d035..6175f51ab5 100644 --- a/common/constants.go +++ b/common/constants.go @@ -16,11 +16,12 @@ const ( LimitPenaltyEpoch = 4 BlocksPerYear = uint64(15768000) LimitThresholdNonceInQueue = 10 - MinGasPrice = 2500 + DefaultMinGasPrice = 2500 MergeSignRange = 15 ) var TIP2019Block = big.NewInt(1050000) var IsTestnet bool = false var StoreRewardFolder string -var RollbackHash Hash \ No newline at end of file +var RollbackHash Hash +var MinGasPrice int64 \ No newline at end of file