transactions: Various fixes and improvements
This MR implements various fixes and improvements for our subtransaction handling. Most importantly, it fixes some races and allows casting votes which are all-zeroes, fixing an incompatibility with ApplyGitattributes. I think that the races should all be benign and not happen in practice, but better be safe than sorry.