Closed DanGould closed 3 months ago
Note, this database structure is almost definitely not what we'll end up using long term, but 1. payjoin sessions are short-lived, and losing them doesn't cause a huge disruption 2. we're in alpha anyway, so we can tolerate this kind of breaking change and 3. I plan to have a better structure out before we release payjoin-cli-0.0.7-alpha. Working on that immediately after this as a follow up.
I changed 3900859 to store recv_sessions and send_sessions a tree. The other DB get methods just return the first element, and clear still clears. This is prep for #283 and fixes --retry
in my manual testing.
Before the next version of payjoin-cli is released to fix async payjoin UX, we're going to need to have a test. I'd like to see an integration test with all of the networking / db implementation in the payjoin/io feature to test it without CLI dependencies. But either payjoin-cli or payjoin integration test would both work. I think we're better off adding the automated test in #283 since the interface is going to change quite a bit.
Agreed, I can take a stab at adding the async integration test on top of #283
I made an initial attempt at adding this to tests here. Not sure if it's sufficient but it at least catches the error fixed by #284 as it stands.
@grizznaut I didn't realize you made a PR into the PR branch. Could you open a new one on this repo? https://github.com/DanGould/rust-payjoin/pull/3 seems like a sound addition to integration tests
TL;DR We keep including more and more persistent state in a miscellaneous .json files. An embedded db gives us the opportunity to fix this.
We need to make async payjoin-cli sessions pleasant to use.
Using payjoin-cli completely asynchronously, including program shutdowns, is a bit clunky and subject to at least one complaint https://github.com/payjoin/rust-payjoin/issues/267.
I revisited the experience by recording a screenshare of doing it and have to say I agree. There are a few problems:
--retry
flag is required to resume a prior sessionThis change is the first of a handful of changes to fix this problem. By using a database, we can handle persistent data in a single file and interact with high performance. To provide a good experience we'll want to address each of the above issues.
By addressing these and later including our solutions in the
io
feature we can create a reference implementation and toolkit for consumers to implement Payjoin V2 easily and appropriately.This is the first step to fix the payjoin-cli async experience problem.