@ -425,7 +425,7 @@ func MakeDataDir(ctx *cli.Context) string {
}
return path
}
log . Crit ( fmt . Sprint f( "Cannot determine default data directory, please set manually (--datadir)" ) )
Fatal f( "Cannot determine default data directory, please set manually (--datadir)" )
return ""
}
@ -451,16 +451,16 @@ func MakeNodeKey(ctx *cli.Context) *ecdsa.PrivateKey {
)
switch {
case file != "" && hex != "" :
log . Crit ( fmt . Sprint f( "Options %q and %q are mutually exclusive" , NodeKeyFileFlag . Name , NodeKeyHexFlag . Name ) )
Fatal f( "Options %q and %q are mutually exclusive" , NodeKeyFileFlag . Name , NodeKeyHexFlag . Name )
case file != "" :
if key , err = crypto . LoadECDSA ( file ) ; err != nil {
log . Crit ( fmt . Sprint f( "Option %q: %v" , NodeKeyFileFlag . Name , err ) )
Fatal f( "Option %q: %v" , NodeKeyFileFlag . Name , err )
}
case hex != "" :
if key , err = crypto . HexToECDSA ( hex ) ; err != nil {
log . Crit ( fmt . Sprint f( "Option %q: %v" , NodeKeyHexFlag . Name , err ) )
Fatal f( "Option %q: %v" , NodeKeyHexFlag . Name , err )
}
}
return key
@ -536,7 +536,7 @@ func MakeDiscoveryV5Address(ctx *cli.Context) string {
func MakeNAT ( ctx * cli . Context ) nat . Interface {
natif , err := nat . Parse ( ctx . GlobalString ( NATFlag . Name ) )
if err != nil {
log . Crit ( fmt . Sprint f( "Option %s: %v" , NATFlag . Name , err ) )
Fatal f( "Option %s: %v" , NATFlag . Name , err )
}
return natif
}
@ -573,11 +573,11 @@ func MakeWSRpcHost(ctx *cli.Context) string {
// for Geth and returns half of the allowance to assign to the database.
func MakeDatabaseHandles ( ) int {
if err := raiseFdLimit ( 2048 ) ; err != nil {
log . Crit ( fmt . Sprint f( "Failed to raise file descriptor allowance: %v" , err ) )
Fatal f( "Failed to raise file descriptor allowance: %v" , err )
}
limit , err := getFdLimit ( )
if err != nil {
log . Crit ( fmt . Sprint f( "Failed to retrieve file descriptor allowance: %v" , err ) )
Fatal f( "Failed to retrieve file descriptor allowance: %v" , err )
}
if limit > 2048 { // cap database file descriptors even if more is available
limit = 2048
@ -619,7 +619,7 @@ func MakeEtherbase(ks *keystore.KeyStore, ctx *cli.Context) common.Address {
// If the specified etherbase is a valid address, return it
account , err := MakeAddress ( ks , etherbase )
if err != nil {
log . Crit ( fmt . Sprint f( "Option %q: %v" , EtherbaseFlag . Name , err ) )
Fatal f( "Option %q: %v" , EtherbaseFlag . Name , err )
}
return account . Address
}
@ -641,7 +641,7 @@ func MakePasswordList(ctx *cli.Context) []string {
}
text , err := ioutil . ReadFile ( path )
if err != nil {
log . Crit ( fmt . Sprint f( "Failed to read password file: %v" , err ) )
Fatal f( "Failed to read password file: %v" , err )
}
lines := strings . Split ( string ( text ) , "\n" )
// Sanitise DOS line endings.
@ -700,14 +700,14 @@ func MakeNode(ctx *cli.Context, name, gitCommit string) *node.Node {
if netrestrict := ctx . GlobalString ( NetrestrictFlag . Name ) ; netrestrict != "" {
list , err := netutil . ParseNetlist ( netrestrict )
if err != nil {
log . Crit ( fmt . Sprint f( "Option %q: %v" , NetrestrictFlag . Name , err ) )
Fatal f( "Option %q: %v" , NetrestrictFlag . Name , err )
}
config . NetRestrict = list
}
stack , err := node . New ( config )
if err != nil {
log . Crit ( fmt . Sprint f( "Failed to create the protocol stack: %v" , err ) )
Fatal f( "Failed to create the protocol stack: %v" , err )
}
return stack
}
@ -723,7 +723,7 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) {
}
}
if networks > 1 {
log . Crit ( fmt . Sprint f( "The %v flags are mutually exclusive" , netFlags ) )
Fatal f( "The %v flags are mutually exclusive" , netFlags )
}
ks := stack . AccountManager ( ) . Backends ( keystore . KeyStoreType ) [ 0 ] . ( * keystore . KeyStore )
@ -777,7 +777,7 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) {
if err := stack . Register ( func ( ctx * node . ServiceContext ) ( node . Service , error ) {
return les . New ( ctx , ethConf )
} ) ; err != nil {
log . Crit ( fmt . Sprint f( "Failed to register the Ethereum light node service: %v" , err ) )
Fatal f( "Failed to register the Ethereum light node service: %v" , err )
}
} else {
if err := stack . Register ( func ( ctx * node . ServiceContext ) ( node . Service , error ) {
@ -788,7 +788,7 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) {
}
return fullNode , err
} ) ; err != nil {
log . Crit ( fmt . Sprint f( "Failed to register the Ethereum full node service: %v" , err ) )
Fatal f( "Failed to register the Ethereum full node service: %v" , err )
}
}
}
@ -796,7 +796,7 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) {
// RegisterShhService configures Whisper and adds it to the given node.
func RegisterShhService ( stack * node . Node ) {
if err := stack . Register ( func ( * node . ServiceContext ) ( node . Service , error ) { return whisper . New ( ) , nil } ) ; err != nil {
log . Crit ( fmt . Sprint f( "Failed to register the Whisper service: %v" , err ) )
Fatal f( "Failed to register the Whisper service: %v" , err )
}
}
@ -813,7 +813,7 @@ func RegisterEthStatsService(stack *node.Node, url string) {
return ethstats . New ( url , ethServ , lesServ )
} ) ; err != nil {
log . Crit ( fmt . Sprint f( "Failed to register the Ethereum Stats service: %v" , err ) )
Fatal f( "Failed to register the Ethereum Stats service: %v" , err )
}
}
@ -844,7 +844,7 @@ func MakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *params.ChainCon
case core . ChainConfigNotFoundErr :
// No configs found, use empty, will populate below
default :
log . Crit ( fmt . Sprint f( "Could not make chain configuration: %v" , err ) )
Fatal f( "Could not make chain configuration: %v" , err )
}
}
// set chain id in case it's zero.
@ -899,7 +899,7 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node) ethdb.Database {
chainDb , err := stack . OpenDatabase ( name , cache , handles )
if err != nil {
log . Crit ( fmt . Sprint f( "Could not open database: %v" , err ) )
Fatal f( "Could not open database: %v" , err )
}
return chainDb
}
@ -912,10 +912,9 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
if ctx . GlobalBool ( TestNetFlag . Name ) {
_ , err := core . WriteTestNetGenesisBlock ( chainDb )
if err != nil {
log . Crit ( fmt . Sprint ( err ) )
Fatalf ( "Failed to write testnet genesis: %v" , err )
}
}
chainConfig := MakeChainConfigFromDb ( ctx , chainDb )
pow := pow . PoW ( core . FakePow { } )
@ -924,7 +923,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
}
chain , err = core . NewBlockChain ( chainDb , chainConfig , pow , new ( event . TypeMux ) , vm . Config { EnablePreimageRecording : ctx . GlobalBool ( VMEnableDebugFlag . Name ) } )
if err != nil {
log . Crit ( fmt . Sprint f( "Could not start chainmanager: %v" , err ) )
Fatal f( "Could not start chainmanager: %v" , err )
}
return chain , chainDb
}