Function: terminateRail(uint256 railId)
This function terminates a rail by setting its end epoch, optionally notifying the validator, removing its rate from the payer’s lockup rate, and updating operator rate usage. It is callable by the operator or a fully settled client.
Inputs
railId
Control: Fully controlled by the caller.
Constraints: Rail must be active and not already terminated; caller must be the operator or the rail client is fully settled.
Impact: Rail is terminated and will close at the end of the grace period.
Branches and code coverage
Intended branches
Terminate as client (settled) or operator.
Reject unauthorized caller.
Notify validator (if set).
Reduce lockup rate and operator usage.