updating shared state in a transaction (and only in that transaction) seems like the right approach.