hotfix: signed recently issue

This commit is contained in:
MestryOmkar 2018-10-25 15:27:34 +05:30
parent bdf9dd8802
commit 7e33e27642

View file

@ -718,9 +718,10 @@ func (c *Clique) Seal(chain consensus.ChainReader, block *types.Block, stop <-ch
if err != nil { if err != nil {
return nil, err return nil, err
} }
masternodes := []common.Address{}
if _, authorized := snap.Signers[signer]; !authorized { if _, authorized := snap.Signers[signer]; !authorized {
valid := false valid := false
masternodes := c.GetMasternodes(chain, header) masternodes = c.GetMasternodes(chain, header)
for _, m := range masternodes { for _, m := range masternodes {
if m == signer { if m == signer {
valid = true valid = true
@ -735,7 +736,7 @@ func (c *Clique) Seal(chain consensus.ChainReader, block *types.Block, stop <-ch
for seen, recent := range snap.Recents { for seen, recent := range snap.Recents {
if recent == signer { if recent == signer {
// Signer is among recents, only wait if the current block doesn't shift it out // Signer is among recents, only wait if the current block doesn't shift it out
if limit := uint64(len(snap.Signers)/2 + 1); number < limit || seen > number-limit { if limit := uint64(len(masternodes)/2 + 1); number < limit || seen > number-limit {
log.Info("Signed recently, must wait for others") log.Info("Signed recently, must wait for others")
<-stop <-stop
return nil, nil return nil, nil