diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-02-12 17:54:14 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-02-12 17:54:14 +0800 |
commit | 69c1f2c2a760fcb1c4229bff06719c73aa8cce31 (patch) | |
tree | d529718305733e9e69b152ccfbd456cc78a69f24 /core | |
parent | 52ad848b2ef5f4c03156f18898e57f303636f52b (diff) | |
download | dexon-69c1f2c2a760fcb1c4229bff06719c73aa8cce31.tar dexon-69c1f2c2a760fcb1c4229bff06719c73aa8cce31.tar.gz dexon-69c1f2c2a760fcb1c4229bff06719c73aa8cce31.tar.bz2 dexon-69c1f2c2a760fcb1c4229bff06719c73aa8cce31.tar.lz dexon-69c1f2c2a760fcb1c4229bff06719c73aa8cce31.tar.xz dexon-69c1f2c2a760fcb1c4229bff06719c73aa8cce31.tar.zst dexon-69c1f2c2a760fcb1c4229bff06719c73aa8cce31.zip |
core: force import known but rolled back blocks
Diffstat (limited to 'core')
-rw-r--r-- | core/blockchain.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index 8d141fddb..e498dedef 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1070,8 +1070,12 @@ func (bc *BlockChain) insertChain(chain types.Blocks) (int, []interface{}, []*ty } switch { case err == ErrKnownBlock: - stats.ignored++ - continue + // Block and state both already known. However if the current block is below + // this number we did a rollback and we should reimport it nonetheless. + if bc.CurrentBlock().NumberU64() >= block.NumberU64() { + stats.ignored++ + continue + } case err == consensus.ErrFutureBlock: // Allow up to MaxFuture second in the future blocks. If this limit is exceeded |