From 9ff9d04a6906cdb941f6797e63b9da7536316b64 Mon Sep 17 00:00:00 2001 From: Ricardo Domingos Date: Fri, 24 Nov 2017 10:20:01 +0100 Subject: all: fix code comment typos (#15547) * console: fix typo in comment * contracts/release: fix typo in comment * core: fix typo in comment * eth: fix typo in comment * miner: fix typo in comment --- console/console.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'console') diff --git a/console/console.go b/console/console.go index 3cd2ad34b..c42c9bfbb 100644 --- a/console/console.go +++ b/console/console.go @@ -47,7 +47,7 @@ const HistoryFile = "history" // DefaultPrompt is the default prompt line prefix to use for user input querying. const DefaultPrompt = "> " -// Config is te collection of configurations to fine tune the behavior of the +// Config is the collection of configurations to fine tune the behavior of the // JavaScript console. type Config struct { DataDir string // Data directory to store the console history at @@ -238,7 +238,7 @@ func (c *Console) AutoCompleteInput(line string, pos int) (string, []string, str // E.g. in case of nested lines eth.getBalance(eth.coinb start := pos - 1 for ; start > 0; start-- { - // Skip all methods and namespaces (i.e. including te dot) + // Skip all methods and namespaces (i.e. including the dot) if line[start] == '.' || (line[start] >= 'a' && line[start] <= 'z') || (line[start] >= 'A' && line[start] <= 'Z') { continue } -- cgit v1.2.3 From f14047dae57aa69e4fa08d57e19ee9c0283dfa54 Mon Sep 17 00:00:00 2001 From: gary rong Date: Fri, 24 Nov 2017 22:10:27 +0800 Subject: cmd, consensus, eth: split ethash related config to it own (#15520) * cmd, consensus, eth: split ethash related config to it own * eth, consensus: minor polish * eth, consenus, console: compress pow testing config field to single one * consensus, eth: document pow mode --- console/console_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'console') diff --git a/console/console_test.go b/console/console_test.go index a159b62bb..d29680785 100644 --- a/console/console_test.go +++ b/console/console_test.go @@ -27,6 +27,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/internal/jsre" @@ -96,7 +97,9 @@ func newTester(t *testing.T, confOverride func(*eth.Config)) *tester { ethConf := ð.Config{ Genesis: core.DeveloperGenesisBlock(15, common.Address{}), Etherbase: common.HexToAddress(testAddress), - PowTest: true, + Ethash: ethash.Config{ + PowMode: ethash.ModeTest, + }, } if confOverride != nil { confOverride(ethConf) -- cgit v1.2.3 From 586198cceaf51435121b7e1166adf21910fee51a Mon Sep 17 00:00:00 2001 From: Sorin Neacsu Date: Fri, 8 Dec 2017 06:14:14 -0800 Subject: console: add admin.clearHistory command (#15614) --- console/console.go | 11 +++++++++++ console/console_test.go | 1 + console/prompter.go | 8 ++++++++ 3 files changed, 20 insertions(+) (limited to 'console') diff --git a/console/console.go b/console/console.go index c42c9bfbb..1ecbfd0b0 100644 --- a/console/console.go +++ b/console/console.go @@ -192,6 +192,7 @@ func (c *Console) init(preload []string) error { if obj := admin.Object(); obj != nil { // make sure the admin api is enabled over the interface obj.Set("sleepBlocks", bridge.SleepBlocks) obj.Set("sleep", bridge.Sleep) + obj.Set("clearHistory", c.clearHistory) } // Preload any JavaScript files before starting the console for _, path := range preload { @@ -216,6 +217,16 @@ func (c *Console) init(preload []string) error { return nil } +func (c *Console) clearHistory() { + c.history = nil + c.prompter.ClearHistory() + if err := os.Remove(c.histPath); err != nil { + fmt.Fprintln(c.printer, "can't delete history file:", err) + } else { + fmt.Fprintln(c.printer, "history file deleted") + } +} + // consoleOutput is an override for the console.log and console.error methods to // stream the output into the configured output stream instead of stdout. func (c *Console) consoleOutput(call otto.FunctionCall) otto.Value { diff --git a/console/console_test.go b/console/console_test.go index d29680785..05aec2cc0 100644 --- a/console/console_test.go +++ b/console/console_test.go @@ -68,6 +68,7 @@ func (p *hookedPrompter) PromptConfirm(prompt string) (bool, error) { } func (p *hookedPrompter) SetHistory(history []string) {} func (p *hookedPrompter) AppendHistory(command string) {} +func (p *hookedPrompter) ClearHistory() {} func (p *hookedPrompter) SetWordCompleter(completer WordCompleter) {} // tester is a console test environment for the console tests to operate on. diff --git a/console/prompter.go b/console/prompter.go index 6acbfb0e2..ea03694d4 100644 --- a/console/prompter.go +++ b/console/prompter.go @@ -51,6 +51,9 @@ type UserPrompter interface { // if and only if the prompt to append was a valid command. AppendHistory(command string) + // ClearHistory clears the entire history + ClearHistory() + // SetWordCompleter sets the completion function that the prompter will call to // fetch completion candidates when the user presses tab. SetWordCompleter(completer WordCompleter) @@ -158,6 +161,11 @@ func (p *terminalPrompter) AppendHistory(command string) { p.State.AppendHistory(command) } +// ClearHistory clears the entire history +func (p *terminalPrompter) ClearHistory() { + p.State.ClearHistory() +} + // SetWordCompleter sets the completion function that the prompter will call to // fetch completion candidates when the user presses tab. func (p *terminalPrompter) SetWordCompleter(completer WordCompleter) { -- cgit v1.2.3