mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
Engine/create (#12)
* added aura to createConsensusEngine * consensus engine create
This commit is contained in:
parent
d08315ecd3
commit
725046997e
2 changed files with 13 additions and 1 deletions
|
|
@ -206,7 +206,7 @@ type Aura struct {
|
|||
lock sync.RWMutex // Protects the signer fields
|
||||
}
|
||||
|
||||
// New creates a Clique proof-of-authority consensus engine with the initial
|
||||
// New creates a Aura proof-of-authority consensus engine with the initial
|
||||
// signers set to the ones provided by the user.
|
||||
func New(config *params.AuraConfig, db ethdb.Database) *Aura {
|
||||
// Set any missing consensus parameters to their defaults
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
"github.com/ethereum/go-ethereum/consensus/aura"
|
||||
)
|
||||
|
||||
type LesServer interface {
|
||||
|
|
@ -220,6 +221,8 @@ func CreateConsensusEngine(ctx *node.ServiceContext, chainConfig *params.ChainCo
|
|||
// If proof-of-authority is requested, set it up
|
||||
if chainConfig.Clique != nil {
|
||||
return clique.New(chainConfig.Clique, db)
|
||||
} else if chainConfig.Aura != nil {
|
||||
return aura.New(chainConfig.Aura, db)
|
||||
}
|
||||
// Otherwise assume proof-of-work
|
||||
switch config.PowMode {
|
||||
|
|
@ -375,6 +378,15 @@ func (s *Ethereum) StartMining(threads int) error {
|
|||
return fmt.Errorf("signer missing: %v", err)
|
||||
}
|
||||
clique.Authorize(eb, wallet.SignHash)
|
||||
} else {
|
||||
if aura, ok := s.engine.(*aura.Aura); ok {
|
||||
wallet, e := s.accountManager.Find(accounts.Account{Address: eb})
|
||||
if wallet == nil || e != nil {
|
||||
log.Error("Etherbase account unavailable locally", "err", err)
|
||||
return fmt.Errorf("signer missing: %v", err)
|
||||
}
|
||||
aura.Authorize(eb, wallet.SignHash)
|
||||
}
|
||||
}
|
||||
// If mining is started, we can disable the transaction rejection mechanism
|
||||
// introduced to speed sync times.
|
||||
|
|
|
|||
Loading…
Reference in a new issue