mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-14 10:06:40 +00:00
[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:
parent
2b09546f8a
commit
a381e8672c
@ -764,7 +764,7 @@ func loadConfig() (*Config, []string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check that 'generate' and 'subnetwork' flags do not conflict
|
// 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 "
|
str := "%s: both generate flag and subnetwork filtering are set "
|
||||||
err := fmt.Errorf(str, funcName)
|
err := fmt.Errorf(str, funcName)
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
"github.com/daglabs/btcd/dagconfig/daghash"
|
"github.com/daglabs/btcd/dagconfig/daghash"
|
||||||
"github.com/daglabs/btcd/database"
|
"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))
|
n, err := wc.curFile.file.WriteAt(data, int64(wc.curOffset))
|
||||||
wc.curOffset += uint32(n)
|
wc.curOffset += uint32(n)
|
||||||
if err != nil {
|
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 "+
|
str := fmt.Sprintf("failed to write %s to file %d at "+
|
||||||
"offset %d: %s", fieldName, wc.curFileNum,
|
"offset %d: %s", fieldName, wc.curFileNum,
|
||||||
wc.curOffset-uint32(n), err)
|
wc.curOffset-uint32(n), err)
|
||||||
|
@ -436,7 +436,7 @@ func (m *CPUMiner) Start() {
|
|||||||
go m.miningWorkerController()
|
go m.miningWorkerController()
|
||||||
|
|
||||||
m.started = true
|
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
|
// Stop gracefully stops the mining process by signalling all workers, and the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user