aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-21 00:08:14 +0800
committerobscuren <geffobscura@gmail.com>2015-04-21 00:08:14 +0800
commit36ec42e50c9367e86621ff58b8e3d835abbbad79 (patch)
tree94c9d0a98b625ca5a8be59f5b780fd3bd54254c7 /cmd
parent76025cc4245f0abc0749f4d1e433be865107bf24 (diff)
parent093a9106b093310acf4c3911baa61916cff52ab8 (diff)
downloaddexon-36ec42e50c9367e86621ff58b8e3d835abbbad79.tar.gz
dexon-36ec42e50c9367e86621ff58b8e3d835abbbad79.tar.zst
dexon-36ec42e50c9367e86621ff58b8e3d835abbbad79.zip
Merge branch 'frontier/natspec' of https://github.com/ethersphere/go-ethereum into ethersphere-frontier/natspec
Diffstat (limited to 'cmd')
-rw-r--r--cmd/geth/js.go18
-rw-r--r--cmd/geth/main.go1
-rw-r--r--cmd/utils/flags.go5
3 files changed, 19 insertions, 5 deletions
diff --git a/cmd/geth/js.go b/cmd/geth/js.go
index 0061f20cf..6e5a6f1c7 100644
--- a/cmd/geth/js.go
+++ b/cmd/geth/js.go
@@ -25,7 +25,8 @@ import (
"strings"
"github.com/ethereum/go-ethereum/cmd/utils"
- "github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/common/docserver"
+ "github.com/ethereum/go-ethereum/common/natspec"
"github.com/ethereum/go-ethereum/eth"
re "github.com/ethereum/go-ethereum/jsre"
"github.com/ethereum/go-ethereum/rpc"
@@ -139,10 +140,17 @@ var net = web3.net;
js.re.Eval(globalRegistrar + "registrar = new GlobalRegistrar(\"" + globalRegistrarAddr + "\");")
}
-func (self *jsre) ConfirmTransaction(tx *types.Transaction) bool {
- p := fmt.Sprintf("Confirm Transaction %v\n[y/n] ", tx)
- answer, _ := self.Prompt(p)
- return strings.HasPrefix(strings.Trim(answer, " "), "y")
+var ds, _ = docserver.New(utils.JSpathFlag.String())
+
+func (self *jsre) ConfirmTransaction(tx string) bool {
+ if self.ethereum.NatSpec {
+ notice := natspec.GetNotice(self.xeth, tx, ds)
+ fmt.Println(notice)
+ answer, _ := self.Prompt("Confirm Transaction\n[y/n] ")
+ return strings.HasPrefix(strings.Trim(answer, " "), "y")
+ } else {
+ return true
+ }
}
func (self *jsre) UnlockAccount(addr []byte) bool {
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index fa6a93b78..97d358407 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -231,6 +231,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.MinerThreadsFlag,
utils.MiningEnabledFlag,
utils.NATFlag,
+ utils.NatspecEnabledFlag,
utils.NodeKeyFileFlag,
utils.NodeKeyHexFlag,
utils.RPCEnabledFlag,
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index a1d9eedda..f70f4243e 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -93,6 +93,10 @@ var (
Name: "identity",
Usage: "node name",
}
+ NatspecEnabledFlag = cli.BoolFlag{
+ Name: "natspec",
+ Usage: "Enable NatSpec confirmation notice",
+ }
// miner settings
MinerThreadsFlag = cli.IntFlag{
@@ -268,6 +272,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name),
Port: ctx.GlobalString(ListenPortFlag.Name),
NAT: GetNAT(ctx),
+ NatSpec: ctx.GlobalBool(NatspecEnabledFlag.Name),
NodeKey: GetNodeKey(ctx),
Shh: true,
Dial: true,