lightninglabs / neutrino

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

fsync instead of calling `Write` #276

Open Crypt-iQ opened 1 year ago

Crypt-iQ commented 1 year ago

Write doesn't sync to disk so a crash can corrupt data. One example of this is here: https://github.com/lightninglabs/neutrino/blob/4bc2c998c726f6438017769da5222cbe1c88ca92/headerfs/file.go#L19-L25

I forget if there are other call-sites

Chinwendu20 commented 11 months ago

Nice. We would just add, file.Sync() for the appendRaw method in headerStore, CFheader store, filterdb store.

mohamedawnallah commented 5 months ago

Hey @Crypt-iQ I've submitted a PR for this issue. I'd love to receive any feedback! 🙏