aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/console/js.go25
-rw-r--r--cmd/console/main.go11
-rw-r--r--cmd/geth/main.go8
-rw-r--r--cmd/utils/flags.go98
4 files changed, 105 insertions, 37 deletions
diff --git a/cmd/console/js.go b/cmd/console/js.go
index a5fdaacc2..15ea9bedd 100644
--- a/cmd/console/js.go
+++ b/cmd/console/js.go
@@ -30,6 +30,7 @@ import (
"sort"
+ "github.com/codegangsta/cli"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common/docserver"
re "github.com/ethereum/go-ethereum/jsre"
@@ -329,7 +330,29 @@ func (self *jsre) welcome(ipcpath string) {
}
}
-func (self *jsre) interactive() {
+func (self *jsre) batch(args cli.Args) {
+ statement := strings.Join(args, " ")
+ val, err := self.re.Run(statement)
+
+ if err != nil {
+ fmt.Printf("error: %v", err)
+ } else if val.IsDefined() && val.IsObject() {
+ obj, _ := self.re.Get("ret_result")
+ fmt.Printf("%v", obj)
+ } else if val.IsDefined() {
+ fmt.Printf("%v", val)
+ }
+
+ if self.atexit != nil {
+ self.atexit()
+ }
+
+ self.re.Stop(false)
+}
+
+func (self *jsre) interactive(ipcpath string) {
+ self.welcome(ipcpath)
+
// Read input lines.
prompt := make(chan string)
inputln := make(chan string)
diff --git a/cmd/console/main.go b/cmd/console/main.go
index e8dd412ba..00a9ca9c4 100644
--- a/cmd/console/main.go
+++ b/cmd/console/main.go
@@ -40,7 +40,7 @@ const (
var (
gitCommit string // set via linker flag
nodeNameVersion string
- app = utils.NewApp(Version, "the ether console")
+ app = utils.NewApp(Version, "the geth console")
)
func init() {
@@ -93,8 +93,11 @@ func main() {
func run(ctx *cli.Context) {
jspath := ctx.GlobalString(utils.JSpathFlag.Name)
ipcpath := utils.IpcSocketPath(ctx)
-
repl := newJSRE(jspath, ipcpath)
- repl.welcome(ipcpath)
- repl.interactive()
+
+ if ctx.Args().Present() {
+ repl.batch(ctx.Args())
+ } else {
+ repl.interactive(ipcpath)
+ }
}
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 0f2438cfd..89aae43e5 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -44,7 +44,7 @@ import (
const (
ClientIdentifier = "Geth"
- Version = "0.9.29"
+ Version = "0.9.31"
)
var (
@@ -256,6 +256,12 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.PProfEanbledFlag,
utils.PProfPortFlag,
utils.SolcPathFlag,
+ utils.GpoMinGasPriceFlag,
+ utils.GpoMaxGasPriceFlag,
+ utils.GpoFullBlockRatioFlag,
+ utils.GpobaseStepDownFlag,
+ utils.GpobaseStepUpFlag,
+ utils.GpobaseCorrectionFactorFlag,
}
app.Before = func(ctx *cli.Context) error {
utils.SetupLogger(ctx)
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index ec29598fb..696dbd142 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -23,10 +23,10 @@ import (
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/rpc"
- "github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/rpc/api"
- "github.com/ethereum/go-ethereum/rpc/comms"
"github.com/ethereum/go-ethereum/rpc/codec"
+ "github.com/ethereum/go-ethereum/rpc/comms"
+ "github.com/ethereum/go-ethereum/xeth"
)
func init() {
@@ -132,7 +132,7 @@ var (
GasPriceFlag = cli.StringFlag{
Name: "gasprice",
Usage: "Sets the minimal gasprice when mining transactions",
- Value: new(big.Int).Mul(big.NewInt(10), common.Szabo).String(),
+ Value: new(big.Int).Mul(big.NewInt(1), common.Szabo).String(),
}
UnlockedAccountFlag = cli.StringFlag{
@@ -276,6 +276,36 @@ var (
Usage: "solidity compiler to be used",
Value: "solc",
}
+ GpoMinGasPriceFlag = cli.StringFlag{
+ Name: "gpomin",
+ Usage: "Minimum suggested gas price",
+ Value: new(big.Int).Mul(big.NewInt(1), common.Szabo).String(),
+ }
+ GpoMaxGasPriceFlag = cli.StringFlag{
+ Name: "gpomax",
+ Usage: "Maximum suggested gas price",
+ Value: new(big.Int).Mul(big.NewInt(100), common.Szabo).String(),
+ }
+ GpoFullBlockRatioFlag = cli.IntFlag{
+ Name: "gpofull",
+ Usage: "Full block threshold for gas price calculation (%)",
+ Value: 80,
+ }
+ GpobaseStepDownFlag = cli.IntFlag{
+ Name: "gpobasedown",
+ Usage: "Suggested gas price base step down ratio (1/1000)",
+ Value: 10,
+ }
+ GpobaseStepUpFlag = cli.IntFlag{
+ Name: "gpobaseup",
+ Usage: "Suggested gas price base step up ratio (1/1000)",
+ Value: 100,
+ }
+ GpobaseCorrectionFactorFlag = cli.IntFlag{
+ Name: "gpobasecf",
+ Usage: "Suggested gas price base correction factor (%)",
+ Value: 110,
+ }
)
// MakeNAT creates a port mapper from set command line flags.
@@ -313,33 +343,39 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
clientID += "/" + customName
}
return &eth.Config{
- Name: common.MakeName(clientID, version),
- DataDir: ctx.GlobalString(DataDirFlag.Name),
- ProtocolVersion: ctx.GlobalInt(ProtocolVersionFlag.Name),
- GenesisNonce: ctx.GlobalInt(GenesisNonceFlag.Name),
- BlockChainVersion: ctx.GlobalInt(BlockchainVersionFlag.Name),
- SkipBcVersionCheck: false,
- NetworkId: ctx.GlobalInt(NetworkIdFlag.Name),
- LogFile: ctx.GlobalString(LogFileFlag.Name),
- Verbosity: ctx.GlobalInt(VerbosityFlag.Name),
- LogJSON: ctx.GlobalString(LogJSONFlag.Name),
- Etherbase: ctx.GlobalString(EtherbaseFlag.Name),
- MinerThreads: ctx.GlobalInt(MinerThreadsFlag.Name),
- AccountManager: MakeAccountManager(ctx),
- VmDebug: ctx.GlobalBool(VMDebugFlag.Name),
- MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name),
- MaxPendingPeers: ctx.GlobalInt(MaxPendingPeersFlag.Name),
- Port: ctx.GlobalString(ListenPortFlag.Name),
- NAT: MakeNAT(ctx),
- NatSpec: ctx.GlobalBool(NatspecEnabledFlag.Name),
- Discovery: !ctx.GlobalBool(NoDiscoverFlag.Name),
- NodeKey: MakeNodeKey(ctx),
- Shh: ctx.GlobalBool(WhisperEnabledFlag.Name),
- Dial: true,
- BootNodes: ctx.GlobalString(BootnodesFlag.Name),
- GasPrice: common.String2Big(ctx.GlobalString(GasPriceFlag.Name)),
- SolcPath: ctx.GlobalString(SolcPathFlag.Name),
- AutoDAG: ctx.GlobalBool(AutoDAGFlag.Name) || ctx.GlobalBool(MiningEnabledFlag.Name),
+ Name: common.MakeName(clientID, version),
+ DataDir: ctx.GlobalString(DataDirFlag.Name),
+ ProtocolVersion: ctx.GlobalInt(ProtocolVersionFlag.Name),
+ GenesisNonce: ctx.GlobalInt(GenesisNonceFlag.Name),
+ BlockChainVersion: ctx.GlobalInt(BlockchainVersionFlag.Name),
+ SkipBcVersionCheck: false,
+ NetworkId: ctx.GlobalInt(NetworkIdFlag.Name),
+ LogFile: ctx.GlobalString(LogFileFlag.Name),
+ Verbosity: ctx.GlobalInt(VerbosityFlag.Name),
+ LogJSON: ctx.GlobalString(LogJSONFlag.Name),
+ Etherbase: ctx.GlobalString(EtherbaseFlag.Name),
+ MinerThreads: ctx.GlobalInt(MinerThreadsFlag.Name),
+ AccountManager: MakeAccountManager(ctx),
+ VmDebug: ctx.GlobalBool(VMDebugFlag.Name),
+ MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name),
+ MaxPendingPeers: ctx.GlobalInt(MaxPendingPeersFlag.Name),
+ Port: ctx.GlobalString(ListenPortFlag.Name),
+ NAT: MakeNAT(ctx),
+ NatSpec: ctx.GlobalBool(NatspecEnabledFlag.Name),
+ Discovery: !ctx.GlobalBool(NoDiscoverFlag.Name),
+ NodeKey: MakeNodeKey(ctx),
+ Shh: ctx.GlobalBool(WhisperEnabledFlag.Name),
+ Dial: true,
+ BootNodes: ctx.GlobalString(BootnodesFlag.Name),
+ GasPrice: common.String2Big(ctx.GlobalString(GasPriceFlag.Name)),
+ GpoMinGasPrice: common.String2Big(ctx.GlobalString(GpoMinGasPriceFlag.Name)),
+ GpoMaxGasPrice: common.String2Big(ctx.GlobalString(GpoMaxGasPriceFlag.Name)),
+ GpoFullBlockRatio: ctx.GlobalInt(GpoFullBlockRatioFlag.Name),
+ GpobaseStepDown: ctx.GlobalInt(GpobaseStepDownFlag.Name),
+ GpobaseStepUp: ctx.GlobalInt(GpobaseStepUpFlag.Name),
+ GpobaseCorrectionFactor: ctx.GlobalInt(GpobaseCorrectionFactorFlag.Name),
+ SolcPath: ctx.GlobalString(SolcPathFlag.Name),
+ AutoDAG: ctx.GlobalBool(AutoDAGFlag.Name) || ctx.GlobalBool(MiningEnabledFlag.Name),
}
}
@@ -396,7 +432,7 @@ func IpcSocketPath(ctx *cli.Context) (ipcpath string) {
if ctx.GlobalString(IPCPathFlag.Name) != common.DefaultIpcPath() {
ipcpath = ctx.GlobalString(IPCPathFlag.Name)
} else if ctx.GlobalString(DataDirFlag.Name) != "" &&
- ctx.GlobalString(DataDirFlag.Name) != common.DefaultDataDir() {
+ ctx.GlobalString(DataDirFlag.Name) != common.DefaultDataDir() {
ipcpath = filepath.Join(ctx.GlobalString(DataDirFlag.Name), "geth.ipc")
}
}