Self-sustained relativistic-runaway-electron avalanches in the transverse field of lightning leader as sources of terrestrial gamma-ray flashes