diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/geth/js.go | 18 | ||||
-rw-r--r-- | cmd/geth/main.go | 1 | ||||
-rw-r--r-- | cmd/utils/flags.go | 5 |
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 e213423ce..ddbd1f129 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -229,6 +229,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 f81645e4e..b8f3982e2 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -96,6 +96,10 @@ var ( Name: "identity", Usage: "node name", } + NatspecEnabledFlag = cli.BoolFlag{ + Name: "natspec", + Usage: "Enable NatSpec confirmation notice", + } // miner settings MinerThreadsFlag = cli.IntFlag{ @@ -284,6 +288,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: ctx.GlobalBool(WhisperEnabledFlag.Name), Dial: true, |