Skip to content

server: settle live payment before LV2V EOS - #4017

Open
fastagents wants to merge 1 commit into
livepeer:masterfrom
fastagents:fix/live-v2v-eos-payment-accounting
Open

server: settle live payment before LV2V EOS#4017
fastagents wants to merge 1 commit into
livepeer:masterfrom
fastagents:fix/live-v2v-eos-payment-accounting

Conversation

@fastagents

Copy link
Copy Markdown

Summary

Settle the final live V2V payment interval before the gateway publishes EOS and
cancels the stream context.

Problem

The gateway currently handles EOSReader before the normal per-segment payment
call. Meanwhile, the orchestrator accounts payment units from elapsed time when
it receives the next segment.

A delayed final partial segment followed by EOS can therefore cause the
orchestrator to account an interval that the gateway never funds. If the
remaining balance is insufficient, the stream may close with an
insufficient-balance error during normal EOS handling.

Changes

  • Process the outstanding payment interval synchronously before publishing
    EOS.
  • Serialize synchronous and asynchronous payment processing to prevent
    overlapping settlement.
  • Add regression coverage confirming final settlement completes before context
    cancellation.

Testing

  • go test ./server -run '^TestLivePaymentProcessor' -count=1
  • go test -race ./server -run '^TestLivePaymentProcessor' -count=1
  • go test ./server -count=1

@github-actions github-actions Bot added go Pull requests that update Go code AI Issues and PR related to the AI-video branch. labels Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Issues and PR related to the AI-video branch. go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant