From 4e32a071060a1d05d048a9c5005617bd60c76b1b Mon Sep 17 00:00:00 2001 From: Nguyen Ba Tam Date: Thu, 21 Mar 2019 15:40:26 +0700 Subject: [PATCH] fix signing with m1 = m2 --- consensus/posv/posv.go | 8 +++++++- miner/worker.go | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/consensus/posv/posv.go b/consensus/posv/posv.go index f11e8b3455..a96bc2e10a 100644 --- a/consensus/posv/posv.go +++ b/consensus/posv/posv.go @@ -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 } diff --git a/miner/worker.go b/miner/worker.go index b3b67b03a1..38b2060186 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -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 }