btcsuite / btcd

An alternative full node bitcoin implementation written in Go (golang)
https://github.com/btcsuite/btcd/blob/master/README.md
ISC License
6.15k stars 2.34k forks source link

Syncing dead-ends on orphan loop; Good block gets called "invalid". #1397

Open christophersanborn opened 5 years ago

christophersanborn commented 5 years ago

Attempting to sync on new install of latest master-branch of btcd. Syncing goes into a repeating loop of about 100 blocks that are "orphaned" because a parent block "is known to be invalid".

2019-03-01 23:31:01.383 [INF] SYNC: Rejected block 000000000000000001037fca0b9c75ecbc70a96eb01cce4021b6471738997d33 from 213.136.91.122:8333 (outbound): previous block 0000000000000000035dbb1bfdca75e510f558f34a1f91f7fe341b55f4822861 is known to be invalid
2019-03-01 23:31:02.418 [INF] CHAN: Adding orphan block 0000000000000000016bf19ec8bcaf14f6add0ac72cbb2942bfcf7a5a96ffaf3 with parent 000000000000000001037fca0b9c75ecbc70a96eb01cce4021b6471738997d33
2019-03-01 23:31:03.366 [INF] CHAN: Adding orphan block 0000000000000000050ffb78a08bc54f39487b83f020a6a931a087ec873d5af7 with parent 0000000000000000016bf19ec8bcaf14f6add0ac72cbb2942bfcf7a5a96ffaf3
...

However, the parent block seems legit to me, based on it's inclusion in block explorer here:

https://www.blockchain.com/btc/block/0000000000000000035dbb1bfdca75e510f558f34a1f91f7fe341b55f4822861

What can I do to get btcd to accept this block and continue to sync beyond it? And why is it seeing the block as invalid? Corrupted download of the block, perhaps? Is there a way to remove it from the DB so that it will be downloaded again?

menzels commented 4 years ago

Hi, i ran into a similar issue. btcd was running fine for a long time and out of a sudden i also got this orphan block thing. i restarted multiple times and let it run for a day, but the orphan block thing kept running. during this time it also stopped accepting new blocks and my node was way behind.

this log lines show where it was started.

2020-02-17 08:27:35.661 [INF] SYNC: Processed 3 blocks in the last 16.1s (1088 transactions, height 616595, 2020-02-09 04:09:19 +0100 CET)
2020-02-17 08:28:32.207 [INF] SYNC: Rejected block 0000000000000000000f0688e7bb3e850920214da120fa04e87b4cab90c776b5 from X.X.X.X:8333 (outbound): output 20bc7acf3f733b71ceb0716fb6876b32d641e7d93ade94093da9895ce1211bcb:1 referenced from transaction 811a8cf0870fc0cf23fbf62a92c2c72a9212078e6283056840d351bbd42d936e:0 either does not exist or has already been spent
2020-02-17 08:28:32.593 [INF] SYNC: Rejected block 0000000000000000000aeb7281baad23fbbdf132c6811697c7e5c18088912848 from X.X.X.X:8333 (outbound): previous block 0000000000000000000f0688e7bb3e850920214da120fa04e87b4cab90c776b5 is known to be invalid
2020-02-17 08:28:33.059 [INF] CHAN: Adding orphan block 000000000000000000094cd82f453d7d5ab14cd335c74f3f6c5d4b9b7b4518ad with parent 0000000000000000000aeb7281baad23fbbdf132c6811697c7e5c18088912848

it feels a bit like there was corruption in the database. if that was the case, it would be nice if btcd could recover from this and do a quick rescan from that point on, and a rebuild of txindex for example. bitcoind is doing something similar.

GeorgeTsagk commented 1 year ago

This also occurred on my node while sync'ing overnight. A valid block was considered invalid and after that the node was stuck in an infinite loop of adding orphan blocks.

Any progress on this?

Labman4 commented 4 months ago

the same as. any progress?