hotfix: signed recently issue

fix #115
This commit is contained in:
Tuna 2018-08-07 18:20:52 +07:00
parent b50c86278d
commit 04d8966857

View file

@ -718,9 +718,10 @@ func (c *Clique) Seal(chain consensus.ChainReader, block *types.Block, stop <-ch
if err != nil {
return nil, err
}
masternodes := []common.Address{}
if _, authorized := snap.Signers[signer]; !authorized {
valid := false
masternodes := c.GetMasternodes(chain, header)
masternodes = c.GetMasternodes(chain, header)
for _, m := range masternodes {
if m == signer {
valid = true
@ -735,7 +736,7 @@ func (c *Clique) Seal(chain consensus.ChainReader, block *types.Block, stop <-ch
for seen, recent := range snap.Recents {
if recent == signer {
// 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")
<-stop
return nil, nil