@@ -1672,7 +1672,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, []
1672
1672
switch {
1673
1673
// First block is pruned, insert as sidechain and reorg only if TD grows enough
1674
1674
case err == consensus .ErrPrunedAncestor :
1675
- return bc .insertSidechain (it )
1675
+ return bc .insertSidechain (block , it )
1676
1676
1677
1677
// First block is future, shove it (and all children) to the future queue (unknown ancestor)
1678
1678
case err == consensus .ErrFutureBlock || (err == consensus .ErrUnknownAncestor && bc .futureBlocks .Contains (it .first ().ParentHash ())):
@@ -1854,7 +1854,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, []
1854
1854
//
1855
1855
// The method writes all (header-and-body-valid) blocks to disk, then tries to
1856
1856
// switch over to the new chain if the TD exceeded the current chain.
1857
- func (bc * BlockChain ) insertSidechain (it * insertIterator ) (int , []interface {}, []* types.Log , error ) {
1857
+ func (bc * BlockChain ) insertSidechain (block * types. Block , it * insertIterator ) (int , []interface {}, []* types.Log , error ) {
1858
1858
var (
1859
1859
externTd * big.Int
1860
1860
current = bc .CurrentBlock ().NumberU64 ()
@@ -1863,7 +1863,7 @@ func (bc *BlockChain) insertSidechain(it *insertIterator) (int, []interface{}, [
1863
1863
// Since we don't import them here, we expect ErrUnknownAncestor for the remaining
1864
1864
// ones. Any other errors means that the block is invalid, and should not be written
1865
1865
// to disk.
1866
- block , err := it . current (), consensus .ErrPrunedAncestor
1866
+ err := consensus .ErrPrunedAncestor
1867
1867
for ; block != nil && (err == consensus .ErrPrunedAncestor ); block , err = it .next () {
1868
1868
// Check the canonical state root for that number
1869
1869
if number := block .NumberU64 (); current >= number {
0 commit comments