[NOD-4] Exit on out of disk space when storing a block (#211)

* [NOD-4] Exit on out of disk space when storing a block

* [NOD-4] Fixed log message

* [NOD-4] Fixed log message

* [NOD-4] Fixed log message
This commit is contained in:
Evgeny Khirin 2019-03-17 11:55:40 +02:00 committed by stasatdaglabs
parent 2b09546f8a
commit a381e8672c
3 changed files with 7 additions and 2 deletions

View File

@ -764,7 +764,7 @@ func loadConfig() (*Config, []string, error) {
}
// Check that 'generate' and 'subnetwork' flags do not conflict
if cfg.Generate && cfg.SubnetworkID.IsEqual(subnetworkid.SubnetworkIDSupportsAll) {
if cfg.Generate && !cfg.SubnetworkID.IsEqual(subnetworkid.SubnetworkIDSupportsAll) {
str := "%s: both generate flag and subnetwork filtering are set "
err := fmt.Errorf(str, funcName)
fmt.Fprintln(os.Stderr, err)

View File

@ -16,6 +16,7 @@ import (
"os"
"path/filepath"
"sync"
"syscall"
"github.com/daglabs/btcd/dagconfig/daghash"
"github.com/daglabs/btcd/database"
@ -385,6 +386,10 @@ func (s *blockStore) writeData(data []byte, fieldName string) error {
n, err := wc.curFile.file.WriteAt(data, int64(wc.curOffset))
wc.curOffset += uint32(n)
if err != nil {
if pathErr, isOk := err.(*os.PathError); isOk && pathErr.Err == syscall.ENOSPC {
log.Errorf("No space left on the hard disk, exiting...")
os.Exit(1)
}
str := fmt.Sprintf("failed to write %s to file %d at "+
"offset %d: %s", fieldName, wc.curFileNum,
wc.curOffset-uint32(n), err)

View File

@ -436,7 +436,7 @@ func (m *CPUMiner) Start() {
go m.miningWorkerController()
m.started = true
log.Infof("CPU miner started")
log.Infof("CPU miner started, number of workers %d", m.numWorkers)
}
// Stop gracefully stops the mining process by signalling all workers, and the