Skip to content

Commit

Permalink
parlia: the newChainHead mights not be imported to Pralia.Snapshot ASAP
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolly23 authored and brilliant-lx committed Oct 28, 2022
1 parent cb131fa commit c46671d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c46671d

Please sign in to comment.