kanzure/webcash

Save destination keys to wallet prior to 'replace' operation to prevent loss of funds

Closed this issue · 0 comments

maaku commented

If the server times out or the network connection is disconnected while performing a replacement, it is possible that the action is still performed by the server even though a confirmation was not received by the client. In such cases the requests python module will error out, which causes the whole operation to be cancelled, and the new ephemeral key is thrown away.

This combination of events, which has happened during recent server overloads, results in certain loss of funds. Although switching to deterministic wallets will mitigate the worst aspects of this problem, a stopgap measure is still needed before then to protect user funds.

Probably the easiest solution is to save the wallet with a "unconfirmed" array of webcash secrets just prior to making the replace API call. Should a wallet later be opened with this field populated, the secrets should be run though the health check API to see if the transaction went through.