lightninglabs / neutrino

Privacy-Preserving Bitcoin Light Client
MIT License
894 stars 182 forks source link

Header doesn't pass sanity check #298

Closed djesys closed 4 months ago

djesys commented 4 months ago

Version: 0.17.4-beta commit=v0.17.4-beta, build=production

Hi,

I noticed that since yesterday neutrino is not syncing anymore due to to

Header doesn't pass sanity check: block difficulty of 386089497 is not the expected value of 3179535695 -- disconnecting peer

I ruled out problems with tor, tried adding new peers to no avail.

lnd.conf

[neutrino] neutrino.addpeer=btcd-mainnet.lightning.computer neutrino.addpeer=btcd0.lightning.computer:18333 neutrino.addpeer=btcd0.lightning.engineering neutrino.addpeer=bb2.breez.technology neutrino.addpeer=lnd.bitrefill.com:18333

neutrino.addpeer=mainnet1-btcd.zaphq.io

neutrino.addpeer=mainnet2-btcd.zaphq.io

neutrino.addpeer=mainnet3-btcd.zaphq.io

neutrino.addpeer=mainnet4-btcd.zaphq.io

neutrino.addpeer=faucet.lightning.community neutrino.feeurl=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json neutrino.broadcasttimeout=5s neutrino.banduration=24h

lncli neutrino status

lncli getinfo

{ "version": "0.17.4-beta commit=v0.17.4-beta", "commit_hash": "8bba79222f439127e46ec3ff7ec7c650e0d88d56", "identity_pubkey": "0345bd578xxxxxxxxxxxxxxxxxx6c493e268862b1", "alias": "xxxxxxxxxxxxx", "color": "#000000", "num_pending_channels": 0, "num_active_channels": 0, "num_inactive_channels": 4, "num_peers": 0, "block_height": 840293, "block_hash": "0000000000000000000261674cf8066408778bbcfbfc7b6af5ee67a0bca03829", "best_header_timestamp": "1713757142", "synced_to_chain": false, "synced_to_graph": false, "testnet": false,

Log snippet:

2024-04-23 01:41:37.309 [INF] BTCN: New valid peer 95.216.242.49:8333 (outbound) (/Satoshi:27.0.0(pro-bitcoin.io)/) 2024-04-23 01:41:37.310 [INF] BTCN: Syncing to block height 840413 from peer 95.216.242.49:8333 2024-04-23 01:41:37.311 [INF] BTCN: Fetching set of headers from tip (height=840394) from peer 95.216.242.49:8333 2024-04-23 01:41:37.526 [WRN] BTCN: Header doesn't pass sanity check: block difficulty of 386089497 is not the expected value of 3179535695 -- disconnecting peer 2024-04-23 01:41:37.527 [INF] BTCN: Lost peer 95.216.242.49:8333 (outbound) 2024-04-23 01:41:37.528 [WRN] BTCN: No sync peer candidates available 2024-04-23 01:41:38.179 [DBG] RPCS: [/lnrpc.Lightning/GetInfo] requested 2024-04-23 01:41:38.462 [INF] BTCN: New valid peer 119.67.35.196:8333 (outbound) (/Satoshi:25.1.0/) 2024-04-23 01:41:38.462 [INF] BTCN: Syncing to block height 840413 from peer 119.67.35.196:8333 2024-04-23 01:41:38.462 [INF] BTCN: Fetching set of headers from tip (height=840394) from peer 119.67.35.196:8333 2024-04-23 01:41:38.851 [INF] BTCN: Lost peer 119.67.35.196:8333 (outbound) 2024-04-23 01:41:38.851 [WRN] BTCN: No sync peer candidates available

Roasbeef commented 4 months ago

Trying to reproduce by syncing a fresh neutrino node, but I was able to sync to the current chain tip no problem:

2024-04-22 23:05:59.852 [INF] BTCN: Attempting to fetch set of un-checkpointed filters at height=840460, hash=000000000000000000024c0085f1379f147cfd02ea554e25bca7702c43ecd8f8
2024-04-22 23:06:02.366 [INF] BTCN: Registering block subscription: id=2
2024-04-22 23:06:02.371 [INF] LNWL: Started rescan from block 0000000000000000000280e54d7b099b1f79689701a7e3a31a8aeb7b8c7aa9a5 (height 840163) for 0 addresses
2024-04-22 23:06:02.372 [INF] BTCN: Canceling block subscription: id=2
2024-04-22 23:06:02.372 [INF] LNWL: Catching up block hashes to height 840164, this might take a while
2024-04-22 23:06:02.385 [INF] LNWL: Done catching up block hashes
2024-04-22 23:06:02.389 [INF] LNWL: Rescanned through block 00000000000000000002339a1afebeec837522b09c763f9105f0b132335c9ad5 (height 840164)
2024-04-22 23:06:02.455 [INF] BTCN: Registering block subscription: id=3
2024-04-22 23:06:05.619 [INF] LNWL: Catching up block hashes to height 840460, this might take a while
2024-04-22 23:06:05.652 [INF] LNWL: Done catching up block hashes
2024-04-22 23:06:05.652 [INF] LNWL: Finished rescan for 0 addresses (synced to block 000000000000000000024c0085f1379f147cfd02ea554e25bca7702c43ecd8f8, height 840460)
2024-04-22 23:06:06.311 [INF] LTND: Chain backend is fully synced (end_height=840460)!

I wonder if it's an index corruption issue? I assume you're using the default boltdb backend for lnd?

djesys commented 4 months ago

yes default boltdb settings.

I guess it's corrupted, likely because I was running low on space. I tried to delete neutrino.db, but upon restarting lnd, it quits with errors, I can post them if it helps. How would I create a new database from scratch?

guggero commented 4 months ago

Posting the errors should help, yes. But I think you might need to delete more than just the neutrino.db, there should also be a block_headers.bin and reg_filter_headers.bin that needs to be deleted.

djesys commented 4 months ago

That did the trick! Thanks