Extract transaction checking

Makes it easier to stub it when this check is not needed (e.g. in tests)