Flush blockchain wallet
![flush blockchain wallet flush blockchain wallet](https://m.media-amazon.com/images/I/81c2PLLPkZS._AC_SS450_.jpg)
![flush blockchain wallet flush blockchain wallet](https://cloudfront-us-east-1.images.arcpublishing.com/coindesk/U36YHNTFIJH3LPYXJKIRNIXRZU.png)
Since sqlite is run in WAL mode, sqlite could be set to use pragma synchronous=NORMAL which the documentation seems to indicate would provide sufficient crash consistency while being faster than pragma synchronous=FULL If faster transaction commits are desired, multiple operations should be batched into a single transaction instead of completely disabling the crash consistency mechanism of the database. The changelog for 1.2.8 indicates that this pragma change was added to improve disk performance. While this doesn't directly explain the numerous database corruption issues seen by people recently (including some in #8694 as those were not caused by a computer crash), there's a good chance that either this, or this combined with some transaction management issue could cause database corruption if chia is stopped improperly. Users should not have to resync the entire blockchain and their wallet if their machine crashes.Īny machine that writes data to any sort of storage device restart chia, database may be reported as corruptedĪs the above depends on the precise timing of when the machine was powered off/crashed relative to I/O submitted by sqlite, this may require several attempts to see a corrupted database.ĭatabase should not become corrupted if the machine crashes.randomly unplug/hard shutdown the machine without waiting for chia to properly stop.launch any chia component that writes data to the sqlite database (full node, wallet), preferably something that needs to sync.Namely, it does not wait for the kernel to notify sqlite that data is persisted, only that it has been submitted to the kernel. The sqlite page for pragmas details why this is unsafe (sorry, you'll have to search for synchronous as I can't link directly to it). This can cause users to lose days of farming time as they wait for the database to resync as well as waste network bandwidth and possibly waste data on their network plan with a data cap. This is unsafe if the machine crashes and will result in users having to resync the blockchain/wallet from scratch. Version 1.2.8/9 began using pragma synchronous=OFF every time a connection to the sqlite database is opened.