From 148495ccfd9c170068cfe086c8b9a8727f989c6e Mon Sep 17 00:00:00 2001 From: Tuna Date: Sat, 12 Jan 2019 15:14:24 +0700 Subject: [PATCH] fix lightchain unit tests --- core/blockchain.go | 6 +----- core/headerchain.go | 3 +-- light/lightchain.go | 6 +----- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index 48e2661111..2f0dc16531 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1684,11 +1684,7 @@ Error: %v // because nonces can be verified sparsely, not needing to check each. func (bc *BlockChain) InsertHeaderChain(chain []*types.Header, checkFreq int) (int, error) { start := time.Now() - state, err := bc.State() - if err != nil { - return 0, err - } - if i, err := bc.hc.ValidateHeaderChain(chain, state, checkFreq); err != nil { + if i, err := bc.hc.ValidateHeaderChain(chain, checkFreq); err != nil { return i, err } diff --git a/core/headerchain.go b/core/headerchain.go index 9bedc796f0..2d1b0a2a18 100644 --- a/core/headerchain.go +++ b/core/headerchain.go @@ -33,7 +33,6 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/hashicorp/golang-lru" - "github.com/ethereum/go-ethereum/core/state" ) const ( @@ -204,7 +203,7 @@ func (hc *HeaderChain) WriteHeader(header *types.Header) (status WriteStatus, er // header writes should be protected by the parent chain mutex individually. type WhCallback func(*types.Header) error -func (hc *HeaderChain) ValidateHeaderChain(chain []*types.Header, state *state.StateDB, checkFreq int) (int, error) { +func (hc *HeaderChain) ValidateHeaderChain(chain []*types.Header, checkFreq int) (int, error) { // Do a sanity check that the provided chain is actually ordered and linked for i := 1; i < len(chain); i++ { if chain[i].Number.Uint64() != chain[i-1].Number.Uint64()+1 || chain[i].ParentHash != chain[i-1].Hash() { diff --git a/light/lightchain.go b/light/lightchain.go index a59535049d..2784615d35 100644 --- a/light/lightchain.go +++ b/light/lightchain.go @@ -344,11 +344,7 @@ func (self *LightChain) postChainEvents(events []interface{}) { // chain events when necessary. func (self *LightChain) InsertHeaderChain(chain []*types.Header, checkFreq int) (int, error) { start := time.Now() - state, err := self.State() - if err != nil { - return 0, err - } - if i, err := self.hc.ValidateHeaderChain(chain, state, checkFreq); err != nil { + if i, err := self.hc.ValidateHeaderChain(chain, checkFreq); err != nil { return i, err }