parlia: the newChainHead mights not be imported to Pralia.Snapshot ASAP
This commit is contained in:
parent
cb131fabe5
commit
c46671df97
@ -929,8 +929,8 @@ func (p *Parlia) IsLocalBlock(header *types.Header) bool {
|
|||||||
return p.val == header.Coinbase
|
return p.val == header.Coinbase
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Parlia) SignRecently(chain consensus.ChainReader, parent *types.Header) (bool, error) {
|
func (p *Parlia) SignRecently(chain consensus.ChainReader, parent *types.Block) (bool, error) {
|
||||||
snap, err := p.snapshot(chain, parent.Number.Uint64(), parent.ParentHash, nil)
|
snap, err := p.snapshot(chain, parent.NumberU64(), parent.Hash(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return true, err
|
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
|
// 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 {
|
for seen, recent := range snap.Recents {
|
||||||
if recent == p.val {
|
if recent == p.val {
|
||||||
// Signer is among recents, only wait if the current block doesn't shift it out
|
// Signer is among recents, only wait if the current block doesn't shift it out
|
||||||
|
@ -470,7 +470,7 @@ func (w *worker) newWorkLoop(recommit time.Duration) {
|
|||||||
clearPending(head.Block.NumberU64())
|
clearPending(head.Block.NumberU64())
|
||||||
timestamp = time.Now().Unix()
|
timestamp = time.Now().Unix()
|
||||||
if p, ok := w.engine.(*parlia.Parlia); ok {
|
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 {
|
if err != nil {
|
||||||
log.Info("Not allowed to propose block", "err", err)
|
log.Info("Not allowed to propose block", "err", err)
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user