Bitcoin Forum
November 19, 2024, 06:27:34 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How can I rollback Bitcoin Core backwards to re-download some blocks again ?  (Read 221 times)
scott.carter.2020 (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 10


View Profile
July 14, 2020, 05:21:32 AM
 #1

If my Bitcoin Core is fully synced but I want to roll it back to re-download few blocks back, 10 blocks for example, how I can do that safely ?
LoyceV
Legendary
*
Offline Offline

Activity: 3500
Merit: 17698


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
July 14, 2020, 06:10:07 AM
 #2

If my Bitcoin Core is fully synced but I want to roll it back to re-download few blocks back, 10 blocks for example, how I can do that safely ?
From what I've read: you should just delete the last few block files in your "blocks" directory. However, when I tried this, it triggered a full download of all blocks.

I'm curious though: why do you want this, if your client is working fine?

▄▄███████████████████▄▄
▄█████████▀█████████████▄
███████████▄▐▀▄██████████
███████▀▀███████▀▀███████
██████▀███▄▄████████████
█████████▐█████████▐█████
█████████▐█████████▐█████
██████████▀███▀███▄██████
████████████████▄▄███████
███████████▄▄▄███████████
█████████████████████████
▀█████▄▄████████████████▀
▀▀███████████████████▀▀
Peach
BTC bitcoin
Buy and Sell
Bitcoin P2P
.
.
▄▄███████▄▄
▄████████
██████▄
▄██
█████████████████▄
▄███████
██████████████▄
███████████████████████
█████████████████████████
████████████████████████
█████████████████████████
▀███████████████████████▀
▀█████████████████████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀

▀▀▀▀███▀▀▀▀
EUROPE | AFRICA
LATIN AMERICA
▄▀▀▀











▀▄▄▄


███████▄█
███████▀
██▄▄▄▄▄░▄▄▄▄▄
████████████▀
▐███████████▌
▐███████████▌
████████████▄
██████████████
███▀███▀▀███▀
.
Download on the
App Store
▀▀▀▄











▄▄▄▀
▄▀▀▀











▀▄▄▄


▄██▄
██████▄
█████████▄
████████████▄
███████████████
████████████▀
█████████▀
██████▀
▀██▀
.
GET IT ON
Google Play
▀▀▀▄











▄▄▄▀
DaveF
Legendary
*
Offline Offline

Activity: 3668
Merit: 6673


Crypto Swap Exchange


View Profile WWW
July 14, 2020, 02:39:14 PM
Last edit: July 14, 2020, 03:24:48 PM by DaveF
 #3

EDIT: The below is bad / wrong advice, but I'm leaving it here as a monument to my stupidity :-)
Seriously, don't do it. ranochigo is correct.
But at least you now know what not to do



You can use the invalidateblock command.

You don't use the block number, you use the block hash.
So from the console if you want to invalidate block 639210 you would use
invalidateblock 0000000000000000000c7072e78db32b61a63fce2e56937167598bbaed9d653d

Then shutdown core and restart and you should pick up from there.

Obligatory, make sure you have a backup of your wallet.dat and anything else you need.

-Dave



█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
ranochigo
Legendary
*
Offline Offline

Activity: 3038
Merit: 4420


Crypto Swap Exchange


View Profile
July 14, 2020, 02:50:54 PM
Merited by LoyceV (6), DaveF (3)
 #4

You can use the invalidateblock command.

You don't use the block number, you use the block hash.
So from the console if you want to invalidate block 639210 you would use
invalidateblock 0000000000000000000c7072e78db32b61a63fce2e56937167598bbaed9d653d

Then shutdown core and restart and you should pick up from there.

Obligatory, make sure you have a backup of your wallet.dat and anything else you need.

-Dave



It won't work. Invalidating the block means that the client marks that block as invalid and the block prior to that will permanently be the longest chain in that client's perspective (unless someone continues to mine from 639209 again onwards). The client will not synchronize anymore after this.

I don't think it deletes the block data either? Just marking it invalid in the chainstate.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
ranochigo
Legendary
*
Offline Offline

Activity: 3038
Merit: 4420


Crypto Swap Exchange


View Profile
July 14, 2020, 03:14:02 PM
Merited by DaveF (3)
 #5

I don't think it deletes the block data either? Just marking it invalid in the chainstate.

Are you sure? I thought the shutdown / restart would cause it to start up again from where it thought it was.

Let me go spin up a VM and take a look. You could be correct, it's been so long since I used it I don't remember. Only used it a few times for testing.

-Dave
Yep, just tried it again on my testnet. My instance doesn't connect to the peers anymore, probably marked the other nodes as misbehaving nodes. Debug log has this:
Code:
2020-07-14T15:11:09Z ERROR: AcceptBlockHeader: block [Block hash I marked invalid] is marked invalid
.

Anyone knows how to revert this without reindex? Tongue

Nevermind, reconsiderblock did the job.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
DaveF
Legendary
*
Offline Offline

Activity: 3668
Merit: 6673


Crypto Swap Exchange


View Profile WWW
July 14, 2020, 03:19:15 PM
 #6

You are correct, sorry for the bad advice.
-Dave

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
OcTradism
Hero Member
*****
Offline Offline

Activity: 1932
Merit: 864



View Profile WWW
July 14, 2020, 04:29:51 PM
 #7

It can only happen with prune node, not full node. Re setup your prune node storage and resync your prune node. It will resync your wallets to latest blocks that fits the new storage parameter you reset.

Of course, problem might be : you must calculate or estimate as exactly as possible the total size of latest blocks you want to redownload.

Cons: you only can do this for latest blocks and can not do it aims at whatever block you want.

I don't do it in practice, it is my shower thought. I thought that total latest blocks with 50 GB for a prune node will be less than total latest blocks with 60 GB for a prune node. (change prune=x)

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits.
..........UNLEASH..........
THE ULTIMATE
GAMING EXPERIENCE
DUELBITS
FANTASY
SPORTS
████▄▄█████▄▄
░▄████
███████████▄
▐███
███████████████▄
███
████████████████
███
████████████████▌
███
██████████████████
████████████████▀▀▀
███████████████▌
███████████████▌
████████████████
████████████████
████████████████
████▀▀███████▀▀
.
▬▬
VS
▬▬
████▄▄▄█████▄▄▄
░▄████████████████▄
▐██████████████████▄
████████████████████
████████████████████▌
█████████████████████
███████████████████
███████████████▌
███████████████▌
████████████████
████████████████
████████████████
████▀▀███████▀▀
/// PLAY FOR  FREE  ///
WIN FOR REAL
..PLAY NOW..
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!