[Cashtab] Patch firma redemptions calc issue
Summary:
There is not a great way to generate an agora partial as close as possible to (but below) a given price. So, in Cashtab, we iteratively generate offers until we get "just below" the this threshhold.
In initial testing, usually it took 2 or 3 attempts. But getting lots of reports about hitting max attempts, and I am able to repeat. It depends on the bid price and the quantity.
Bump the max attempts to 25. I have not seen more than 10. But as long as we are preventing an infinite loop, it is better to try 25 times than to have an inexplicable error at 5 times.
We also need to clear the error so the button is not disabled, requiring a refresh when this happens.
Test Plan:
npm test
We have an existing test that confirms we iteratively generate partial offers. It would be possible to test a case where we iterate 10 times or do not reach a max, but I think the impact is not worth the effort to create and maintain such a test. It would be better to add a method to ecash-agora that supports creating an offer at or below a target price and test there.
error:
- Try to redeem firma, say $5, then try 10, 15, 20, etc, wait to see this error, notice the button spinner is there until page refresh
- Try the same quantity on the test site with this patch, no error (https://cashtab-local-dev.netlify.app/)
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien, Qawtr
Differential Revision: https://reviews.bitcoinabc.org/D17973