genesis bor config

This commit is contained in:
Jaynti Kanani 2019-05-20 17:42:06 +05:30
parent 34bcfb42a3
commit 2c630dffda
No known key found for this signature in database
GPG key ID: 4396982C976BAE5E

View file

@ -112,6 +112,33 @@ func (w *wizard) makeGenesis() {
ProducerDelay: 5,
Epoch: 30000,
}
// We also need the initial list of signers
fmt.Println()
fmt.Println("Which accounts are allowed to seal? (mandatory at least one)")
var signers []common.Address
for {
if address := w.readAddress(); address != nil {
signers = append(signers, *address)
continue
}
if len(signers) > 0 {
break
}
}
// Sort the signers and embed into the extra-data section
for i := 0; i < len(signers); i++ {
for j := i + 1; j < len(signers); j++ {
if bytes.Compare(signers[i][:], signers[j][:]) > 0 {
signers[i], signers[j] = signers[j], signers[i]
}
}
}
genesis.ExtraData = make([]byte, 32+len(signers)*common.AddressLength+65)
for i, signer := range signers {
copy(genesis.ExtraData[32+i*common.AddressLength:], signer[:])
}
default:
log.Crit("Invalid consensus engine choice", "choice", choice)
}