get10101 / 10101

10101 (Ten-Ten-One): Self-custodial derivative trading at your fingertips.
https://10101.finance
MIT License
130 stars 23 forks source link

Handle reject renew offer if position gets resized #2558

Open holzeis opened 6 months ago

holzeis commented 6 months ago

If a renew offer gets rejected, e.g. because the app was closed before the RenewOffer was successfully processed, the coordinator can't correctly process the reject at the moment.

https://github.com/get10101/10101/blob/567266a215cf6c3da42c8ed16156afa3900bef3e/coordinator/src/node.rs#L470-L489

For one the position state wouldn't get updated correctly. Fixing that isn't too hard, but then you run into the following issue, which seems to be a bit more complicated.

Failed to resize position 18: Could not propose resize DLC channel update: Invalid parameters were provided: Sum of collaterals in contract must equal total collateral in channel.