diff --git a/consensus/ethash/ethash.go b/consensus/ethash/ethash.go index ac049f9c36..701f6c51ea 100644 --- a/consensus/ethash/ethash.go +++ b/consensus/ethash/ethash.go @@ -64,6 +64,8 @@ func isLittleEndian() bool { } // memoryMap tries to memory map a file of uint32s for read only access. +// mmap is a portable memory map package which would enable direct access for +// memory mapping files func memoryMap(path string) (*os.File, mmap.MMap, []uint32, error) { file, err := os.OpenFile(path, os.O_RDONLY, 0644) if err != nil { @@ -346,7 +348,8 @@ func (d *dataset) generate(dir string, limit int, test bool) { }) } -// finalizer closes any file handlers and memory maps open. +// finalizer closes any file handlers and use Unmap() to deletes the memory mapped region, +// flushes any remaining changes. func (d *dataset) finalizer() { if d.mmap != nil { d.mmap.Unmap() diff --git a/console/console.go b/console/console.go index 1bceb7bc65..81711e7726 100644 --- a/console/console.go +++ b/console/console.go @@ -60,11 +60,11 @@ type Config struct { Preload []string // Absolute paths to JavaScript files to preload } -// Console is a JavaScript interpreted runtime environment. It is a fully fleged +// Console is a JavaScript interpreted runtime environment. It is a fully fledged // JavaScript console attached to a running node via an external or in-process RPC // client. type Console struct { - client *rpc.Client // RPC client to execute Ethereum requests through + client *rpc.Client // RPC client to execute Ethereum requests through rpc jsre *jsre.JSRE // JavaScript runtime environment running the interpreter prompt string // Input prompt prefix string prompter UserPrompter // Input prompter to allow interactive user feedback @@ -76,7 +76,7 @@ type Console struct { // New initializes a JavaScript interpreted runtime environment and sets defaults // with the config struct. func New(config Config) (*Console, error) { - // Handle unset config values gracefully + // Handle unset config values with default value if config.Prompter == nil { config.Prompter = Stdin } @@ -84,7 +84,7 @@ func New(config Config) (*Console, error) { config.Prompt = DefaultPrompt } if config.Printer == nil { - config.Printer = colorable.NewColorableStdout() + config.Printer = colorable.NewColorableStdout() // colorful standard output } // Initialize the console and return console := &Console{