Skip to content

feat(node): don't reactively top up a near-expiry channel; open a fresh channel mid-pull #1603

Closed

Description

@alpergundogdu

Problem

The reactive mid-pull top-up (#1600) funds the existing channel and resumes, but top_up_channel checks only spendable headroom, not remaining time to expires_at. topUp deliberately does not extend expiry (the contract forbids it). So a reactive top-up on a near-expiry channel can escrow a fresh working-deposit into a channel that expires before it can be spent — stranding capital until reclaim, and risking the pull failing anyway.

The proactive refill path only runs behind the try_reuse_live non-expired gate; the reactive leg has no equivalent expiry guard.

Proposed direction

  • Add a config knob, in seconds, for a minimum remaining-time-to-expiry margin (e.g. defaulting to roughly a day). Seconds so operators can tune it per chain lane.
  • Before a reactive top-up, if the channel has less than that margin to expires_at, do not top up the near-expiry channel.
  • Instead, open a fresh channel and continue streaming the remainder through it (mid-flight channel switch), rather than escrowing into a channel that cannot spend the deposit before expiry.

Mid-flight opening of a new channel and continuing the stream through it may warrant its own separate issue if it turns out to be substantial; splitting is fine. The near-expiry guard (don't fund a channel about to expire) is the immediate correctness piece.

Context

Follow-up from the review of #1600 (reactive mid-pull deposit top-up, #1530). Merged as-is. Prior top-up PRs repeatedly treated "topUp does not extend expiry" as load-bearing, so the reactive leg needs an explicit expiry posture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:featureprio:highrust

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions