Merge pull request #473 from nguyenbatam/fix_m1_equal_m2

fix signing with m1 = m2
This commit is contained in:
Tuna 2019-03-22 15:24:40 +07:00 committed by GitHub
commit 65fb524a27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 return nil, err
} }
copy(header.Extra[len(header.Extra)-extraSeal:], sighash) 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 return block.WithSeal(header), nil
} }

View file

@ -330,7 +330,7 @@ func (self *worker) wait() {
continue continue
} }
block := result.Block 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}) self.mux.Post(core.NewMinedBlockEvent{Block: block})
continue continue
} }