Skip to content

Fix proceeds calculation#2508

Open
alicecoordinator wants to merge 1 commit into
RoboSats:mainfrom
alicecoordinator:fix-proceeds-calculation
Open

Fix proceeds calculation#2508
alicecoordinator wants to merge 1 commit into
RoboSats:mainfrom
alicecoordinator:fix-proceeds-calculation

Conversation

@alicecoordinator
Copy link
Copy Markdown
Contributor

@alicecoordinator alicecoordinator commented Jun 5, 2026

A new method transition_status was added, to prevent race conditions while two processes try to transition the order status at the same time.

With the old implementation, if the payout takes a bit longer, the background job could start new tasks for the same payout, which would cause the order status to go from status 13 to 14 back and forth a few times.

Additionally, the compute_proceeds call was moved to later in the process for LN payouts, so that the payout fee is always updated.

What does this PR do?

Fixes #2447

Checklist before merging

  • Install pre-commit and initialize it: pip install pre-commit, then pre-commit install. Pre-commit installs git hooks that automatically check the codebase. If pre-commit fails when you commit your changes, please fix the problems it points out.

A new method `transition_status` was added, to prevent race conditions
while two processes try to transition the order status at the same
time.

With the old implementation, if the payout takes a bit longer, the
background job could start new tasks for the same payout, which would
cause the order status to go from status 13 to 14 back and forth a few
times.

Additionally, the compute_proceeds call was moved to later in the
process for LN payouts, so that the payout fee is always updated.
@alicecoordinator alicecoordinator force-pushed the fix-proceeds-calculation branch from 3fa702a to be29298 Compare June 6, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: proceeds are calculated before payout invoice is settled

1 participant