cmd/puppeth: figure out consensus engine for eccpow

This commit is contained in:
Your Name 2024-04-23 13:07:55 +09:00
parent 7b0bd8bb76
commit b1853568f5
2 changed files with 20 additions and 0 deletions

View file

@ -58,6 +58,7 @@ func (w *wizard) makeGenesis() {
fmt.Println("Which consensus engine to use? (default = clique)") fmt.Println("Which consensus engine to use? (default = clique)")
fmt.Println(" 1. Ethash - proof-of-work") fmt.Println(" 1. Ethash - proof-of-work")
fmt.Println(" 2. Clique - proof-of-authority") fmt.Println(" 2. Clique - proof-of-authority")
fmt.Println(" 3. EccPoW - proof-of-work with LDPC")
choice := w.read() choice := w.read()
switch { switch {
@ -103,6 +104,10 @@ func (w *wizard) makeGenesis() {
for i, signer := range signers { for i, signer := range signers {
copy(genesis.ExtraData[32+i*common.AddressLength:], signer[:]) copy(genesis.ExtraData[32+i*common.AddressLength:], signer[:])
} }
case choice == "3":
// In case of eccpow, we're pretty much done
genesis.Config.Eccpow = new(params.EccpowConfig)
genesis.ExtraData = make([]byte, 32)
default: default:
log.Crit("Invalid consensus engine choice", "choice", choice) log.Crit("Invalid consensus engine choice", "choice", choice)

View file

@ -146,6 +146,21 @@ func (w *wizard) deployNode(boot bool) {
return return
} }
} }
} else if w.conf.Genesis.Config.Eccpow != nil {
// Eccpow based miners only need an etherbase to mine against
fmt.Println()
if infos.etherbase == "" {
fmt.Printf("What address should the miner use?\n")
for {
if address := w.readAddress(); address != nil {
infos.etherbase = address.Hex()
break
}
}
} else {
fmt.Printf("What address should the miner use? (default = %s)\n", infos.etherbase)
infos.etherbase = w.readDefaultAddress(common.HexToAddress(infos.etherbase)).Hex()
}
} }
// Establish the gas dynamics to be enforced by the signer // Establish the gas dynamics to be enforced by the signer
fmt.Println() fmt.Println()