Add 'dirty' flag to transactions to speed up commits of empty tx.

Empty transactions, ie those that haven't done anything, will now just
abort instead of commiting.