News for hackers. Stuff that matters.
Re:Don't trust default timeouts by earthboundkid on Saturday August 29, 2020 @09:32PM (#24320632)
Doesn’t that just create a Byzantine generals problem?

My understanding is that real payment systems solve the problem by just taking a day to finalize transactions…

Re:Don't trust default timeouts by KallDrexx on Saturday August 29, 2020 @11:57PM (#24321248)
I don't know what the Byzantine generals problem is.

Two stage commit is important because it has: 1) Predefined transaction id prior to final submission that allows you to validate the status, so if your request to commit gets 503'ed or you get a timeout you can reliably query to know if it was processed or not 2) Unlimited resubmissions of the final commit. It doesn't matter if I perform the final commit api request 1 time or 100 times, it will never cause a duplicated transaction to occur. So if I get a timeout or a 503 I can resubmit knowing that if my original commit request went in my new submit will be a no-op, and if my last commit request didn't get processed then this time it hopefully will be processed.

This pattern isn't just a payments pattern thing either. This is heavily used in distributed systems where failures can occur. UPS' API used to use this as well so you could be sure that you don't pay for duplicate shipping labels or cause duplicate shippments.

Re:Don't trust default timeouts by user5994461 on Sunday August 30, 2020 @07:03AM (#24322621)
The Byzantine general problem is the field of research dealing with consensus/consistency issues like what we discuss here. The baseline is that there are two generals on a battlefield trying to coordinate an attack, they send messengers to communicate but any message might be lost or intercepted. The problem is proven to be unsolvable so let's not go heads in assuming you can be sure of any outcome ;)

https://en.wikipedia.org/wiki/Two_Generals%27_Problem

https://en.wikipedia.org/wiki/Byzantine_fault

Re:Don't trust default timeouts by afiori on Sunday August 30, 2020 @04:03AM (#24322050)
Taking longer does not solve the byzantine generals problem. The difference here is that the role are asymmetrical: once the bank receive your order for a transaction it does not need to check that you know whether the order was correctly received; the bank can simply perform the transaction and them best-effort let you know of what happened.
Re:Don't trust default timeouts by earthboundkid on Sunday August 30, 2020 @07:45PM (#24327005)
I wasn’t suggesting that banks solve an insolvable problem. They just ignore it by doing something else.