Skip to content

Commit

Permalink
Changed signaturs to match aura namespace (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
ansermino authored and priom committed Sep 8, 2018
1 parent fe9dbab commit 6163173
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 76 deletions.
29 changes: 14 additions & 15 deletions consensus/aura/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ import (
// mechanisms of the proof-of-authority scheme.
type API struct {
chain consensus.ChainReader
//clique *Clique
//aura *Aura
aura *Aura
}

// GetSnapshot retrieves the state snapshot at a given block.
Expand All @@ -44,7 +43,7 @@ func (api *API) GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error) {
if header == nil {
return nil, errUnknownBlock
}
return api.clique.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil)
return api.aura.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil)
}

// GetSnapshotAtHash retrieves the state snapshot at a given block.
Expand All @@ -53,7 +52,7 @@ func (api *API) GetSnapshotAtHash(hash common.Hash) (*Snapshot, error) {
if header == nil {
return nil, errUnknownBlock
}
return api.clique.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil)
return api.aura.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil)
}

// GetSigners retrieves the list of authorized signers at the specified block.
Expand All @@ -69,7 +68,7 @@ func (api *API) GetSigners(number *rpc.BlockNumber) ([]common.Address, error) {
if header == nil {
return nil, errUnknownBlock
}
snap, err := api.clique.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil)
snap, err := api.aura.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil)
if err != nil {
return nil, err
}
Expand All @@ -82,7 +81,7 @@ func (api *API) GetSignersAtHash(hash common.Hash) ([]common.Address, error) {
if header == nil {
return nil, errUnknownBlock
}
snap, err := api.clique.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil)
snap, err := api.aura.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil)
if err != nil {
return nil, err
}
Expand All @@ -91,11 +90,11 @@ func (api *API) GetSignersAtHash(hash common.Hash) ([]common.Address, error) {

// Proposals returns the current proposals the node tries to uphold and vote on.
func (api *API) Proposals() map[common.Address]bool {
api.clique.lock.RLock()
defer api.clique.lock.RUnlock()
api.aura.lock.RLock()
defer api.aura.lock.RUnlock()

proposals := make(map[common.Address]bool)
for address, auth := range api.clique.proposals {
for address, auth := range api.aura.proposals {
proposals[address] = auth
}
return proposals
Expand All @@ -104,17 +103,17 @@ func (api *API) Proposals() map[common.Address]bool {
// Propose injects a new authorization proposal that the signer will attempt to
// push through.
func (api *API) Propose(address common.Address, auth bool) {
api.clique.lock.Lock()
defer api.clique.lock.Unlock()
api.aura.lock.Lock()
defer api.aura.lock.Unlock()

api.clique.proposals[address] = auth
api.aura.proposals[address] = auth
}

// Discard drops a currently running proposal, stopping the signer from casting
// further votes (either for or against).
func (api *API) Discard(address common.Address) {
api.clique.lock.Lock()
defer api.clique.lock.Unlock()
api.aura.lock.Lock()
defer api.aura.lock.Unlock()

delete(api.clique.proposals, address)
delete(api.aura.proposals, address)
}
Loading

0 comments on commit 6163173

Please sign in to comment.