reliable channel end handling, and better relay upgrading logic