Using gas from flag

This commit is contained in:
parmarrushabh 2018-12-07 10:56:50 +05:30
parent 7ef8da4fee
commit 68dbddadc0
2 changed files with 18 additions and 9 deletions

View file

@ -28,6 +28,7 @@ import (
"unicode" "unicode"
"github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/dashboard" "github.com/ethereum/go-ethereum/dashboard"
"github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/internal/debug" "github.com/ethereum/go-ethereum/internal/debug"
@ -36,7 +37,6 @@ import (
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
whisper "github.com/ethereum/go-ethereum/whisper/whisperv6" whisper "github.com/ethereum/go-ethereum/whisper/whisperv6"
"github.com/naoina/toml" "github.com/naoina/toml"
"github.com/ethereum/go-ethereum/common"
) )
var ( var (
@ -154,15 +154,23 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) {
// Check testnet is enable. // Check testnet is enable.
if ctx.GlobalBool(utils.XDCTestnetFlag.Name) { if ctx.GlobalBool(utils.XDCTestnetFlag.Name) {
common.IsTestnet = true common.IsTestnet = true
} }
// Check rollback hash exist. // Check rollback hash exist.
if rollbackHash := ctx.GlobalString(utils.RollbackFlag.Name); rollbackHash != "" { if rollbackHash := ctx.GlobalString(utils.RollbackFlag.Name); rollbackHash != "" {
common.RollbackHash = common.HexToHash(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{} passwords := []string{}
for _, env := range cfg.Account.Passwords { for _, env := range cfg.Account.Passwords {
if trimmed := strings.TrimSpace(env); trimmed != "" { if trimmed := strings.TrimSpace(env); trimmed != "" {

View file

@ -16,11 +16,12 @@ const (
LimitPenaltyEpoch = 4 LimitPenaltyEpoch = 4
BlocksPerYear = uint64(15768000) BlocksPerYear = uint64(15768000)
LimitThresholdNonceInQueue = 10 LimitThresholdNonceInQueue = 10
MinGasPrice = 2500 DefaultMinGasPrice = 2500
MergeSignRange = 15 MergeSignRange = 15
) )
var TIP2019Block = big.NewInt(1050000) var TIP2019Block = big.NewInt(1050000)
var IsTestnet bool = false var IsTestnet bool = false
var StoreRewardFolder string var StoreRewardFolder string
var RollbackHash Hash var RollbackHash Hash
var MinGasPrice int64