mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-04 18:35:03 +00:00
eth: reset skeleton after chain rewinded
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
16f50285b7
commit
896113e436
2 changed files with 8 additions and 0 deletions
|
|
@ -63,6 +63,7 @@ func (b *EthAPIBackend) CurrentBlock() *types.Header {
|
|||
|
||||
func (b *EthAPIBackend) SetHead(number uint64) {
|
||||
b.eth.handler.downloader.Cancel()
|
||||
b.eth.handler.downloader.ResetSkeleton()
|
||||
b.eth.blockchain.SetHead(number)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -662,6 +662,13 @@ func (d *Downloader) Cancel() {
|
|||
d.blockchain.InterruptInsert(false)
|
||||
}
|
||||
|
||||
// ResetSkeleton terminates the skeleton syncer and reinitializes it.
|
||||
func (d *Downloader) ResetSkeleton() {
|
||||
d.skeleton.Terminate()
|
||||
rawdb.DeleteSkeletonSyncStatus(d.stateDB)
|
||||
d.skeleton = newSkeleton(d.stateDB, d.peers, d.dropPeer, d.skeleton.filler)
|
||||
}
|
||||
|
||||
// Terminate interrupts the downloader, canceling all pending operations.
|
||||
// The downloader cannot be reused after calling Terminate.
|
||||
func (d *Downloader) Terminate() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue