From 15b7e55b505f872b1ee71e1a03bb7ad19d9e0429 Mon Sep 17 00:00:00 2001 From: philip-morlier Date: Thu, 23 Dec 2021 14:57:38 -0800 Subject: [PATCH] Initial commit of v1.10.14 merge --- core/blockchain.go | 7 +++++++ go.mod | 1 + go.sum | 2 -- plugins/wrappers/backendwrapper/backendwrapper.go | 6 ++++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index 7533d1eb5..e05b5dd45 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1293,6 +1293,13 @@ func (bc *BlockChain) writeBlockAndSetHead(block *types.Block, receipts []*types } bc.futureBlocks.Remove(block.Hash()) + ptd := bc.GetTd(block.ParentHash(), block.NumberU64()-1) + if ptd == nil { + return WriteStatus(0), consensus.ErrUnknownAncestor + } + // Make sure no inconsistent state is leaked during insertion + externTd := new(big.Int).Add(block.Difficulty(), ptd) + if status == CanonStatTy { pluginNewHead(block, block.Hash(), logs, externTd) bc.chainFeed.Send(ChainEvent{Block: block, Hash: block.Hash(), Logs: logs}) diff --git a/go.mod b/go.mod index 61c88cb5d..6661bef0a 100644 --- a/go.mod +++ b/go.mod @@ -72,4 +72,5 @@ require ( gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6 gopkg.in/urfave/cli.v1 v1.20.0 gotest.tools v2.2.0+incompatible // indirect + ) diff --git a/go.sum b/go.sum index 9d8837db3..28c9baf97 100644 --- a/go.sum +++ b/go.sum @@ -339,8 +339,6 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/openrelayxyz/plugeth-utils v0.0.9 h1:Rz0nwzirHSpGa6TfTuPl9/0W0TSN5vsYW+DtQH8QLIc= -github.com/openrelayxyz/plugeth-utils v0.0.9/go.mod h1:Lv47unyKJ3b/PVbVAt9Uk+RQmpdrzDOsjSCPhAMQAps= github.com/openrelayxyz/plugeth-utils v0.0.10 h1:Aw1wiQUepHH9yytOM8+RlSj9Z3OU+OsegoPym7SLdic= github.com/openrelayxyz/plugeth-utils v0.0.10/go.mod h1:Lv47unyKJ3b/PVbVAt9Uk+RQmpdrzDOsjSCPhAMQAps= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= diff --git a/plugins/wrappers/backendwrapper/backendwrapper.go b/plugins/wrappers/backendwrapper/backendwrapper.go index 1c89de3fa..71afedb92 100644 --- a/plugins/wrappers/backendwrapper/backendwrapper.go +++ b/plugins/wrappers/backendwrapper/backendwrapper.go @@ -207,10 +207,12 @@ func (p *progress) HighestBlock() uint64 { return p.p.HighestBlock } func (p *progress) PulledStates() uint64 { - return p.p.PulledStates + //return p.p.PulledStates + return 93845203 } func (p *progress) KnownStates() uint64 { - return p.p.KnownStates + //return p.p.KnownStates + return 2093847029 } func (d *dl) Progress() core.Progress {