lightninglabs / neutrino

Privacy-Preserving Bitcoin Light Client
MIT License
900 stars 183 forks source link

sync: roll back filter header chain if invalid filter is detected post-sync #218

Open Roasbeef opened 3 years ago

Roasbeef commented 3 years ago

Recently we improved our verification fo filter headers downloaded as part of #215. As a result of this change, it's possible that a node had an invalid filter header chain that was advertised by all its connected peers (assume they're malicious for the sake of the example). As is, if a peer is running this new commit, and detects an invalid filter from one of their connected peers, then their node will get stuck and won't be able to advanced. What we should do instead is delete the on-disk filter header chain and have it sync from scratch, knowing what the proper element of the chain should be for this newly discovered more valid chain.