4 ms·
There are a couple ways you could do this, though according to jerf in a comment below, banks often don't implement transactions as commutative. Most commonly
by knucklesandwich 10y ago
There are a couple ways you could do this, though according to jerf in a comment below, banks often don't implement transactions as commutative.
Most commonly things like this are done by somehow reifying the operation as data and attaching some information to determine ordering. One way would be to attach a timestamp to bank transactions. By itself, that would be enough to ensure bank transactions commute (but without bounds on clock synchronization, wouldn't guarantee that you see those operations in the order you issue them). You could also require a single consistent read to an account to get a state version number and attach an incremented version of that in your transaction. Ties in both cases could be resolved by account id of the person initiating the transaction.