interledger-rs
interledger-rs copied to clipboard
Recover from crashes after updating balances for prepare (before fulfill is received)
FWIW, the reason I originally had these other values here was to allow for better ways of accounting for the balance. This store isn't doing proper accounting right now. If the server crashes after
update_balances_for_prepare
but before the fulfillment is received, the money from thefrom
account will effectively disappear. A better way to do it would be to put that money (atomically) into another account, from which it would be transferred when the fulfillment comes in. One thing I'm not sure about is whether that pending balance would be linked to thefrom
account, to thefrom
andto
accounts (meaning there would be a separate row for pending balance between any pairs of accounts, which doesn't seem great), or neither.
We could do it like a 2phase commit, the prepare would decrease 'from' and increase 'to' temporary fields, and on fulfil it would apply them to the actual state.
_Originally posted by @emschwartz in https://github.com/render_node/MDE3OlB1bGxSZXF1ZXN0UmV2aWV3MjY3ODEyOTAz/pull_request_reviews/more_threads