Ukrainians have been bracing for a major attack on the power system for weeks, fearing crippling damage to the grid that would cause long blackouts.