Fix withDynTransaction.

Run the block in a dynamic session with a transaction, don't try to wrap
a session function for the block in a transaction (which will fail) and
then run it.

Review by @cvogt