mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
Devnet private key (#2639)
This commit is contained in:
parent
a4f9df9ee8
commit
dd7f197db3
@ -232,8 +232,8 @@ var (
|
||||
Usage: "Public address for block mining rewards",
|
||||
Value: "0",
|
||||
}
|
||||
MinerSigningKeyFlag = cli.StringFlag{
|
||||
Name: "miner.sigkey",
|
||||
MinerSigningKeyFileFlag = cli.StringFlag{
|
||||
Name: "miner.sigfile",
|
||||
Usage: "Private key to sign blocks with",
|
||||
Value: "",
|
||||
}
|
||||
@ -774,22 +774,18 @@ func SplitAndTrim(input string) (ret []string) {
|
||||
// setEtherbase retrieves the etherbase from the directly specified
|
||||
// command line flags.
|
||||
func setEtherbase(ctx *cli.Context, cfg *ethconfig.Config) {
|
||||
if ctx.GlobalIsSet(MinerSigningKeyFlag.Name) {
|
||||
sigkey := ctx.GlobalString(MinerSigningKeyFlag.Name)
|
||||
if sigkey != "" {
|
||||
var err error
|
||||
cfg.Miner.SigKey, err = crypto.HexToECDSA(sigkey)
|
||||
if err != nil {
|
||||
Fatalf("Failed to parse ECDSA private key: %v", err)
|
||||
}
|
||||
cfg.Miner.Etherbase = crypto.PubkeyToAddress(cfg.Miner.SigKey.PublicKey)
|
||||
}
|
||||
} else if ctx.GlobalIsSet(MinerEtherbaseFlag.Name) {
|
||||
etherbase := ctx.GlobalString(MinerEtherbaseFlag.Name)
|
||||
var etherbase string
|
||||
if ctx.GlobalIsSet(MinerEtherbaseFlag.Name) {
|
||||
etherbase = ctx.GlobalString(MinerEtherbaseFlag.Name)
|
||||
if etherbase != "" {
|
||||
cfg.Miner.Etherbase = common.HexToAddress(etherbase)
|
||||
}
|
||||
}
|
||||
|
||||
if etherbase == "" && ctx.GlobalString(ChainFlag.Name) == params.DevChainName {
|
||||
cfg.Miner.SigKey = core.DevnetSignPrivateKey
|
||||
cfg.Miner.Etherbase = core.DevnetEtherbase
|
||||
}
|
||||
}
|
||||
|
||||
func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config, nodeName, dataDir string) {
|
||||
@ -994,7 +990,7 @@ func SetupMinerCobra(cmd *cobra.Command, cfg *params.MiningConfig) {
|
||||
panic(err)
|
||||
}
|
||||
if cfg.Enabled && len(cfg.Etherbase.Bytes()) == 0 {
|
||||
panic(fmt.Sprintf("Erigon supports only remote miners. Flag --%s or --%s is required", MinerNotifyFlag.Name, MinerSigningKeyFlag.Name))
|
||||
panic(fmt.Sprintf("Erigon supports only remote miners. Flag --%s or --%s is required", MinerNotifyFlag.Name, MinerSigningKeyFileFlag.Name))
|
||||
}
|
||||
cfg.Notify, err = flags.GetStringArray(MinerNotifyFlag.Name)
|
||||
if err != nil {
|
||||
@ -1061,7 +1057,7 @@ func setMiner(ctx *cli.Context, cfg *params.MiningConfig) {
|
||||
cfg.Enabled = true
|
||||
}
|
||||
if cfg.Enabled && len(cfg.Etherbase.Bytes()) == 0 {
|
||||
panic(fmt.Sprintf("Erigon supports only remote miners. Flag --%s or --%s is required", MinerNotifyFlag.Name, MinerSigningKeyFlag.Name))
|
||||
panic(fmt.Sprintf("Erigon supports only remote miners. Flag --%s or --%s is required", MinerNotifyFlag.Name, MinerSigningKeyFileFlag.Name))
|
||||
}
|
||||
if ctx.GlobalIsSet(MinerNotifyFlag.Name) {
|
||||
cfg.Notify = strings.Split(ctx.GlobalString(MinerNotifyFlag.Name), ",")
|
||||
@ -1152,7 +1148,7 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) {
|
||||
|
||||
// SetEthConfig applies eth-related command line flags to the config.
|
||||
func SetEthConfig(ctx *cli.Context, nodeConfig *node.Config, cfg *ethconfig.Config) {
|
||||
CheckExclusive(ctx, MinerSigningKeyFlag, MinerEtherbaseFlag)
|
||||
CheckExclusive(ctx, MinerSigningKeyFileFlag, MinerEtherbaseFlag)
|
||||
setEtherbase(ctx, cfg)
|
||||
setGPO(ctx, &cfg.GPO)
|
||||
setTxPool(ctx, &cfg.TxPool)
|
||||
|
@ -601,6 +601,9 @@ func DefaultSokolGenesisBlock() *Genesis {
|
||||
}
|
||||
}
|
||||
|
||||
var DevnetSignPrivateKey, _ = crypto.HexToECDSA("289c2857d4598e37fb9647507e47a309d6133539bf21a8b9cb6df88fd5232032")
|
||||
var DevnetEtherbase = common.HexToAddress("970e8128ab834e8eac17ab8e3812f010678cf791") // crypto.PubkeyToAddress(DevnetSignPrivateKey.PublicKey)
|
||||
|
||||
// DeveloperGenesisBlock returns the 'geth --dev' genesis block.
|
||||
func DeveloperGenesisBlock(period uint64, faucet common.Address) *Genesis {
|
||||
// Override the default period to the user requested one
|
||||
|
@ -533,7 +533,6 @@ func (s *Ethereum) StartMining(ctx context.Context, kv kv.RwDB, mining *stagedsy
|
||||
if !cfg.Enabled {
|
||||
return nil
|
||||
}
|
||||
|
||||
s.txPool.SetGasPrice(gasPrice)
|
||||
|
||||
// Configure the local mining address
|
||||
|
@ -104,6 +104,7 @@ func SpawnMiningCreateBlockStage(s *StageState, tx kv.RwTx, cfg MiningCreateBloc
|
||||
if parent == nil { // todo: how to return error and don't stop Erigon?
|
||||
return fmt.Errorf(fmt.Sprintf("[%s] Empty block", logPrefix), "blocknum", executionAt)
|
||||
}
|
||||
log.Info(fmt.Sprintf("[%s] Start mine", logPrefix), "block", executionAt+1)
|
||||
|
||||
blockNum := executionAt + 1
|
||||
signer := types.MakeSigner(&cfg.chainConfig, blockNum)
|
||||
@ -285,7 +286,6 @@ func SpawnMiningCreateBlockStage(s *StageState, tx kv.RwTx, cfg MiningCreateBloc
|
||||
|
||||
current.LocalTxs = types.NewTransactionsByPriceAndNonce(*signer, localTxs)
|
||||
current.RemoteTxs = types.NewTransactionsByPriceAndNonce(*signer, remoteTxs)
|
||||
fmt.Printf("aa: %t, %t,%t\n", current == nil, cfg.miner.MiningBlock == nil, current.Header == nil)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -78,6 +78,6 @@ var DefaultFlags = []cli.Flag{
|
||||
utils.MinerEtherbaseFlag,
|
||||
utils.MinerExtraDataFlag,
|
||||
utils.MinerNoVerfiyFlag,
|
||||
utils.MinerSigningKeyFlag,
|
||||
utils.MinerSigningKeyFileFlag,
|
||||
utils.SentryAddrFlag,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user