From c46671df97038edf83ddaef8eeeaa978f2a63d71 Mon Sep 17 00:00:00 2001 From: Jolly Zhao Date: Thu, 20 Oct 2022 01:45:32 +0800 Subject: [PATCH] parlia: the newChainHead mights not be imported to Pralia.Snapshot ASAP --- consensus/parlia/parlia.go | 6 +++--- miner/worker.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/consensus/parlia/parlia.go b/consensus/parlia/parlia.go index 33ed15a627..fee0fe1293 100644 --- a/consensus/parlia/parlia.go +++ b/consensus/parlia/parlia.go @@ -929,8 +929,8 @@ func (p *Parlia) IsLocalBlock(header *types.Header) bool { return p.val == header.Coinbase } -func (p *Parlia) SignRecently(chain consensus.ChainReader, parent *types.Header) (bool, error) { - snap, err := p.snapshot(chain, parent.Number.Uint64(), parent.ParentHash, nil) +func (p *Parlia) SignRecently(chain consensus.ChainReader, parent *types.Block) (bool, error) { + snap, err := p.snapshot(chain, parent.NumberU64(), parent.Hash(), nil) if err != nil { return true, err } @@ -941,7 +941,7 @@ func (p *Parlia) SignRecently(chain consensus.ChainReader, parent *types.Header) } // If we're amongst the recent signers, wait for the next block - number := parent.Number.Uint64() + 1 + number := parent.NumberU64() + 1 for seen, recent := range snap.Recents { if recent == p.val { // Signer is among recents, only wait if the current block doesn't shift it out diff --git a/miner/worker.go b/miner/worker.go index 7a7eaf14c5..5577a5c051 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -470,7 +470,7 @@ func (w *worker) newWorkLoop(recommit time.Duration) { clearPending(head.Block.NumberU64()) timestamp = time.Now().Unix() if p, ok := w.engine.(*parlia.Parlia); ok { - signedRecent, err := p.SignRecently(w.chain, head.Block.Header()) + signedRecent, err := p.SignRecently(w.chain, head.Block) if err != nil { log.Info("Not allowed to propose block", "err", err) continue