Skip to content

Commit

Permalink
masternode[0] will create block 1
Browse files Browse the repository at this point in the history
  • Loading branch information
ngtuna committed Jul 5, 2018
1 parent 95a0928 commit 3a139d6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions consensus/clique/clique.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,16 +406,16 @@ func (c *Clique) GetMasternodes(chain consensus.ChainReader, header *types.Heade
}

func YourTurn(masternodes []common.Address, snap *Snapshot, header *types.Header, cur common.Address) (bool, error) {
if header.Number.Uint64() == 0 {
// Not check signer for genesis block.
return true, nil
}

pre, err := ecrecover(header, snap.sigcache)
if err != nil {
return false, err
pre := common.Address{}
// masternode[0] has chance to create block 1
preIndex := -1
if header.Number.Uint64() != 0 {
pre, err := ecrecover(header, snap.sigcache)
if err != nil {
return false, err
}
preIndex = position(masternodes, pre)
}
preIndex := position(masternodes, pre)
curIndex := position(masternodes, cur)
log.Info("Debugging info", "number of masternodes", len(masternodes), "previous", pre, "position", preIndex, "current", cur, "position", curIndex)
for i, s := range masternodes {
Expand Down

0 comments on commit 3a139d6

Please sign in to comment.