Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[RPC][mempool]: Add savemempool RPC #11099
Adds a simple parameterless rpc command to dump the mempool.
Sometimes there can be a crash for whatever reason (bug, power loss, etc) causing the mempool.dat file to not be saved.
This change allows to script/cron the rpc call to have more regular saves to the file as well as cli/ad-hoc.
This should solve issue #11086
I think either is fine. bitcoind should always be able to write to its data directory, so I would say failure to do so counts as an internal error.
I also don't like the test framework messing with bitcoind's data directory. I don't think the failure testcase is necessary. If bitcoind can't write to its datadirectory, there are more pressing issues than the RPC raising the correct error.
Agree with @MarcoFalke that it might be a good idea to combine this with the mempool_persist.py test (if it can be done tidily).
Updated slightly the tests only: removed the ugly rename of the node directory in favor of using permissions to make it fail in the test
@MarcoFalke Permissions initially didn't work because there was a rename involved from a tmp file but it works if I use permissions on the tmp file that gets renamed ('mempool.dat.new') so switched to that
I also removed from the test some redundant asserts re: os.remove doing its job (it already throws if it can't find a file or fails to remove it)
I much, much prefer using file permissions on the
mempool.dat file instead of deleting directories.
A few nits in the testcase, but otherwise looks great. Thanks for indulging all of my review comments :)
Ah. Very crafty! Can you add a comment to the test to explain that (
On Aug 20, 2017 9:46 PM, "GreenAddress" ***@***.***> wrote: @promag <https://github.com/promag> thanks, updated as for feedback and squashed — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#11099 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AVfQPLGwbbeqOskROywlYWaVocTD-14rks5saOFhgaJpZM4O8sJC> .
There is only one test for
dumpmempool failure, which is the
can't write to mempool.dat.new. However there is another
return false; inside the
catch (which I can't understand why) that should be tested.
RenameOver() doesn't throw, and IMO we should fail if the
mempool.dat can't be updated.