I'm running v0.17.2, but I'm on the wrong chain?

We’ve gotten this question:

I upgraded to v0.17.2, but I’m still on the wrong chain. It’s stuck below block 641999. What’s going on, and how do I fix it?

Answer:

BTC Core v0.17.2 protects users from an attack which started on July 1st, but only if it is installed before the attack was released. It does this by only accepting the honestly-mined version of this block:

height block 640650, blockhash:
00000001ca8ac90d83f6f5da01ac96b7a017702a040953b93cda2e52b07385cd

This is enforced as a checkpoint in v0.17.2.

An attacker began secretly mining on July 1st, but released their 1300+ dishonest blocks on July 10. If you were running v0.15.2 or v0.17.1 when the release happened, then your node has already accepted the dishonest version of that block:

height 640650, blockhash
00000000635620f22ba8694aea532d51619f8cd060f4e42e85db3cb3a5d1c29c

The checkpoint only checks for the honest block 640650 when it’s receiving a block 640650, and you received the dishonest one before your software was checking it! It doesn’t go re-checking every block in the chain every time you start it.

How do I fix it?

If you tell your node to re-validate the chain, it will fix this by going through all the blocks again, but that can take hours. Or if you delete all your blockchain data and re-sync, it will also fix this, but that will take even longer and be a huge download. Forunately, there’s a quicker, easier way.

Just tell your node that the dishonest block is invalid with this command:

invalidateblock 00000000635620f22ba8694aea532d51619f8cd060f4e42e85db3cb3a5d1c29c

If you’re running the BTG GUI, you can go into Help - Debug - Console, here:


Copy the command like this, and hit enter.:

image

That’s it! Your node should toss aside the dishonest stuff and sync right up with the rest of the network.

If you’re using the command-line daemon instead of the gui, you’ll use this command:

bgold-cli invalidateblock 00000000635620f22ba8694aea532d51619f8cd060f4e42e85db3cb3a5d1c29c

It does the exact same thing.

Afterwards, you can easily check if you’re on the public chain by comparing to another node, or a blockchain explorer.

How do you check?

In the GUI, just go to Help - Debug - Information:

image

Look for Current number of blocks:

image

If this is what you see, you’re stuck on the bad chain. Run the invalidateblock command described above and it should straighten you right out - even if you’re on an older version like 0.17.1!

As of this writing, the honest chain is at block height 642060; you can always check on a BTG Explorer like this one.

image

If you want to be super-careful, click into the most recent block on the explorer and compare the blockhash you see:

image

With the latest bockhash your node has, which you can bring up with this command at the command line:

image

Or this in the GUI:
image

Did this help you? Let us know!

4 Likes

It’s written really really easily!!!

2 Likes

The block validation logic that takes care of the checkpoint only applies when it receives a new block, not when reading from the disk. So you need to either invalidate the bad chain, or do a complete reindex (-reindex=1).

1 Like

If you’ve run the invalidateblock command on your node under version 0.15.2 or 0.17.1, you’ll still want to upgrade to 0.17.2; this will ensure that your nodes stays on the correct chain in case you need to rebuild or -reindex it.

EDIT: This is no longer necessary to get on the correct chain; the honest chain overtook the attacker’s chain and all nodes have re-convereged. However, it can be a prudent additional safety measure until this incident is many days old.