Allow specifying a tx-fun.
Merge bug 26000 (into stable this time)