fix signing with m1 = m2

This commit is contained in:
Nguyen Ba Tam 2019-03-21 15:40:26 +07:00
parent feb1031abe
commit 4e32a07106
2 changed files with 8 additions and 2 deletions

View file

@ -977,7 +977,13 @@ func (c *Posv) Seal(chain consensus.ChainReader, block *types.Block, stop <-chan
return nil, err
}
copy(header.Extra[len(header.Extra)-extraSeal:], sighash)
m2, err := c.GetValidator(signer, chain, header)
if err != nil {
return nil, fmt.Errorf("can't get block validator: %v", err)
}
if m2 == signer {
header.Validator = sighash
}
return block.WithSeal(header), nil
}

View file

@ -330,7 +330,7 @@ func (self *worker) wait() {
continue
}
block := result.Block
if self.config.Posv != nil && block.NumberU64() >= self.config.Posv.Epoch {
if self.config.Posv != nil && block.NumberU64() >= self.config.Posv.Epoch && len(block.Validator()) == 0 {
self.mux.Post(core.NewMinedBlockEvent{Block: block})
continue
}