Fix for template Postgres tests failing on LN. For #6101.
Made context a named argument at the start of every transaction.