diff options
author | obscuren <geffobscura@gmail.com> | 2015-05-09 18:04:00 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-05-09 18:04:00 +0800 |
commit | 13ddf20bd20707141309fbfa969183a7afbe5a80 (patch) | |
tree | 9993ee85bdc29aba49798e504b7bf6a1aba60294 /cmd/geth | |
parent | cb1fa523e4930841f4cc92689c850c7831810d03 (diff) | |
download | go-tangerine-13ddf20bd20707141309fbfa969183a7afbe5a80.tar.gz go-tangerine-13ddf20bd20707141309fbfa969183a7afbe5a80.tar.zst go-tangerine-13ddf20bd20707141309fbfa969183a7afbe5a80.zip |
miner, cmd/geth: settable gas price from flags and console
* --gasprice "<num>" flag
* admin.miner.setGasPrice( <num> )
Diffstat (limited to 'cmd/geth')
-rw-r--r-- | cmd/geth/admin.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go index 49e2dc6f8..2b9956638 100644 --- a/cmd/geth/admin.go +++ b/cmd/geth/admin.go @@ -70,6 +70,7 @@ func (js *jsre) adminBindings() { miner.Set("stop", js.stopMining) miner.Set("hashrate", js.hashrate) miner.Set("setExtra", js.setExtra) + miner.Set("setGasPrice", js.setGasPrice) admin.Set("debug", struct{}{}) t, _ = admin.Get("debug") @@ -236,6 +237,17 @@ func (js *jsre) setExtra(call otto.FunctionCall) otto.Value { return otto.UndefinedValue() } +func (js *jsre) setGasPrice(call otto.FunctionCall) otto.Value { + gasPrice, err := call.Argument(0).ToString() + if err != nil { + fmt.Println(err) + return otto.UndefinedValue() + } + + js.ethereum.Miner().SetGasPrice(common.String2Big(gasPrice)) + return otto.UndefinedValue() +} + func (js *jsre) hashrate(otto.FunctionCall) otto.Value { return js.re.ToVal(js.ethereum.Miner().HashRate()) } |