# The final resolution of Error: Invalid or corrupt peers.dat

**URL:** <https://community.umbrel.com/t/the-final-resolution-of-error-invalid-or-corrupt-peers-dat/12936>\
**Category:** Guides\
**Created:** [July 1, 2023, 4:23am UTC](https://community.umbrel.com/t/the-final-resolution-of-error-invalid-or-corrupt-peers-dat/12936 "2023-07-01T04:23:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![usernameisJim](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.umbrel.com/usernameisjim/32/3309_2.png) [@usernameisJim](https://community.umbrel.com/u/usernameisJim)\
**Post date:** [July 1, 2023, 4:23am UTC](https://community.umbrel.com/t/the-final-resolution-of-error-invalid-or-corrupt-peers-dat/12936/1 "2023-07-01T04:23:09Z")

</div>

After completing these steps be sure to update your Bitcoin Node app to 25.0

**Bitcoin Core is what Bitcoin Node is using, and this was fixed after version 24.0.1 and should no longer occur!**

After having issues syncing Bitcoin and then checking your debug logs you may see a line that shows up like this:

"`Error: Invalid or corrupt peers.dat (Checksum mismatch, data corrupted)"`

Here are the steps to follow to delete the peers.dat and restart Bitcoin,

Connect to your Umbrel by following the instructions in the [Official FAQ under How to SSH into Umbrel on a Raspberry Pi](https://community.umbrel.com/t/official-umbrel-troubleshooting-guide-and-faq/9873) or by accessing a terminal on your Linux machine :

Then stop Bitcoin:

`~/umbrel/scripts/app stop bitcoin`

Then you can delete the peers.dat file:

`rm /home/umbrel/umbrel/app-data/bitcoin/data/bitcoin/peers.dat`

(If the above command works it just sends you to the new line, sometimes this is confusing but that means it was successful otherwise if you run it again you’ll see it now displays “No such file or directory”)

Then start Bitcoin again:

`~/umbrel/scripts/app start bitcoin`

Then please wait at least ~5 minutes, it can sometimes take a little longer.

Now finally reload your dashboard and you will likely see your Bitcoin Node app has begun to synchronize once more, hopefully closer to 99% and only take a few hours to finish.

Now all your apps will work normally again, including Lightning Node, and this also should fix any errors with your Lightning Node apps appearing with the wallet locked error as well once Bitcoin Node app is done resynchronizing

If you are curious on why this error may had been occurring, it was a known bug in Bitcoin 24.0.1 and earlier.

And this is more context here for some of the fixes and where it was merged if you’re curious why this was happening:

> <https://github.com/bitcoin/bitcoin/issues/26599>
>
> When \`peers.dat\` is corrupted an error message is shown: \`Invalid or corrupt pee…rs.dat (Checksum mismatch, data corrupted).\` then the node restart.
> 
> Most of our users aren't really tech enough to manually delete the \`peers.dat\` files, nor can we detect it for them. It means that this error give us lot's of work on our support team when somebody is impacted.
> 
> \`peers.dat\` isn't an essential file, as such Bitcoin Core should just be fine restarting without crashing.
> 
> A bash workaround to detect the checksum mismatch would also considerably help us.

> <https://github.com/bitcoin/bitcoin/pull/26909>
>
> There have been various reports of corruption of \`peers.dat\` recently, see #2659…9.
> As explained in \[this post\](https://github.com/bitcoin/bitcoin/issues/26599#issuecomment-1381082886) in more detail, the underlying issue is likely that we currently serialize \`AddrMan\` twice - once for the file stream, once for the hasher that helps create the checksum - and if \`AddrMan\` changes in between these two calls, the checksum doesn't match the data and the resulting \`peers.dat\` is corrupted. 
> 
> This PR attempts to fix this by introducing and using \`HashedSourceWriter\` - a class that keeps a running hash while serializing data, similar to the existing \`CHashVerifier\` which does the analogous thing while unserializing data. Something like this was suggested before, see https://github.com/bitcoin/bitcoin/pull/10248#discussion\_r120694343.
> 
> Fixes #26599 (not by changing the behavior in case of a crash, but by hopefully fixing the underlying cause of these corruptions).
