mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16:44 +00:00
touchup
This commit is contained in:
parent
086bf11189
commit
b8c274aab5
2 changed files with 34 additions and 25 deletions
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
@ -239,6 +240,31 @@ func makeFullNode(ctx *cli.Context) *node.Node {
|
||||||
}
|
}
|
||||||
catalyst.RegisterSimulatedBeaconAPIs(stack, simBeacon)
|
catalyst.RegisterSimulatedBeaconAPIs(stack, simBeacon)
|
||||||
stack.RegisterLifecycle(simBeacon)
|
stack.RegisterLifecycle(simBeacon)
|
||||||
|
|
||||||
|
devModeBanner := `You are running Geth in development mode. Please note the following:
|
||||||
|
1. Unless --dev.period is specified, the client will mine blocks as soon as there
|
||||||
|
are transactions in the pool. It will mine as fast as possible until the pool is empty.
|
||||||
|
2. Networking is disabled.`
|
||||||
|
// if we are running in ephemeral dev mode and a keystore is not set,
|
||||||
|
// the default developer address will be prefunded. Let the user know
|
||||||
|
// about this account and its corresponding private key.
|
||||||
|
if !ctx.IsSet(utils.DataDirFlag.Name) && cfg.Eth.Miner.PendingFeeRecipient == utils.DeveloperAddr {
|
||||||
|
devModeBanner += fmt.Sprintf(`
|
||||||
|
3. --datadir has not been specified. The chain will be kept in memory and not persisted
|
||||||
|
after client shutdown. The following account has been prefunded in the Genesis:
|
||||||
|
|
||||||
|
Account
|
||||||
|
------------------
|
||||||
|
0x%x (10^49 ETH)
|
||||||
|
|
||||||
|
Private Key
|
||||||
|
------------------
|
||||||
|
0x%x
|
||||||
|
`, utils.DeveloperAddr, crypto.FromECDSA(utils.DeveloperKey))
|
||||||
|
}
|
||||||
|
for _, line := range strings.Split(devModeBanner, "\n") {
|
||||||
|
log.Warn(line)
|
||||||
|
}
|
||||||
} else if ctx.IsSet(utils.BeaconApiFlag.Name) {
|
} else if ctx.IsSet(utils.BeaconApiFlag.Name) {
|
||||||
// Start blsync mode.
|
// Start blsync mode.
|
||||||
srv := rpc.NewServer()
|
srv := rpc.NewServer()
|
||||||
|
|
|
||||||
|
|
@ -984,6 +984,12 @@ var (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// default account to prefund when running Geth in ephemeral development mode
|
||||||
|
var (
|
||||||
|
DeveloperKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||||
|
DeveloperAddr = crypto.PubkeyToAddress(DeveloperKey.PublicKey)
|
||||||
|
)
|
||||||
|
|
||||||
// MakeDataDir retrieves the currently requested data directory, terminating
|
// MakeDataDir retrieves the currently requested data directory, terminating
|
||||||
// if none (or the empty string) is specified. If the node is starting a testnet,
|
// if none (or the empty string) is specified. If the node is starting a testnet,
|
||||||
// then a subdirectory of the specified datadir will be used.
|
// then a subdirectory of the specified datadir will be used.
|
||||||
|
|
@ -1769,7 +1775,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
||||||
} else if accs := ks.Accounts(); len(accs) > 0 {
|
} else if accs := ks.Accounts(); len(accs) > 0 {
|
||||||
developer = ks.Accounts()[0]
|
developer = ks.Accounts()[0]
|
||||||
} else {
|
} else {
|
||||||
developer, err = ks.NewAccount(passphrase)
|
developer, err = ks.ImportECDSA(DeveloperKey, passphrase)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fatalf("Failed to create developer account: %v", err)
|
Fatalf("Failed to create developer account: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -1808,30 +1814,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
||||||
chaindb.Close()
|
chaindb.Close()
|
||||||
} else {
|
} else {
|
||||||
// if no datadir is specified, dev mode runs ephemerally in memory
|
// if no datadir is specified, dev mode runs ephemerally in memory
|
||||||
var (
|
cfg.Genesis = core.DeveloperGenesisBlock(ctx.Uint64(DeveloperGasLimitFlag.Name), &developer.Address)
|
||||||
devAddr = developer.Address
|
|
||||||
devKey *ecdsa.PrivateKey
|
|
||||||
)
|
|
||||||
if devAddr != (common.Address{}) {
|
|
||||||
devKey, err = crypto.GenerateKey()
|
|
||||||
if err != nil {
|
|
||||||
panic(fmt.Errorf("failed to generate dev mode prefunded account key: %v", err))
|
|
||||||
}
|
|
||||||
devAddr = crypto.PubkeyToAddress(devKey.PublicKey)
|
|
||||||
|
|
||||||
devModeAccountsDescr := fmt.Sprintf(`Available Accounts\n
|
|
||||||
==================
|
|
||||||
(0) 0x%x (10000.000000000000000000 ETH)
|
|
||||||
|
|
||||||
Private Keys
|
|
||||||
==================
|
|
||||||
(0) 0x%x (10000.000000000000000000 ETH)
|
|
||||||
`, devAddr, crypto.FromECDSA(devKey))
|
|
||||||
for _, line := range strings.Split(devModeAccountsDescr, "\n") {
|
|
||||||
log.Info(line)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cfg.Genesis = core.DeveloperGenesisBlock(ctx.Uint64(DeveloperGasLimitFlag.Name), &devAddr)
|
|
||||||
}
|
}
|
||||||
if !ctx.IsSet(MinerGasPriceFlag.Name) {
|
if !ctx.IsSet(MinerGasPriceFlag.Name) {
|
||||||
cfg.Miner.GasPrice = big.NewInt(1)
|
cfg.Miner.GasPrice = big.NewInt(1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue