Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add a database for swap states #1243
DONE: Added Sqlite infrastructure and an Sqlite backed
This task now has the following associated issues, as the numbering implies these should most likely be done in order:
Currently cnd only stores swap states in memory so each new instance of cnd has no access to swaps done by a previous instance of cnd.
Spike 9 (https://github.com/comit-network/spikes/blob/master/0009-comit-btsieve-db.adoc) describes adding a database to cnd in order to save these states to disk. There seems to be no disagreement from the team on the recommendations within this spike. This issue is to implement the recommendations.
Note that it is within the scope of this ticket to define the schema for the database.
Adding a plan of attack here for comments or suggestions. Intend to first put together a draft PR with scope limited to swap metadata. This will mean clients can list all previous swaps but not get any information on them. If I understand correctly, this means only implementing an Sqlite backed version of
Yes that seems reasonable.
At the moment, the e2e tests restart cnd and btsieve for each test to ensure an empty state. As soon as we have a database, that is no longer true. I think the e2e tests will actually break because the often assume that the list of swaps is empty in the beginning. Hence, you will need to modify the test harness to delete the database between the tests.
I think it would make sense to start with a PR that adds the following functionality:
All of that can be done in a PR that can be merged right away. That way we have the necessary infrastructure in place that we need for the other usecases.