I have written a tool that accesses the chainstate LevelDB database to get a list of UTXOs.
https://github.com/in3rsha/bitcoin-utxo-dump/blob/master/utxodump.go
The tool would originally corrupt the database every time I accessed it, forcing me to run bitcoind -reindex-chainstate
to fix it. I was able to get around this by adding a no compression option when accessing the database, which seemed to fix the problem.
However, using this tool will still occasionally corrupt the database, but not always, and I am not sure why.
I'm not looking for a review of the code, but I was wondering if there might be any common reasons why the chainstate database might become corrupted after another program has accessed it (whilst bitcoind
isn't running)?