Skip to content

fix(asb, controller): get-swaps (use correct state, harden exchange rate calculation)#939

Merged
Einliterflasche merged 1 commit intomasterfrom
fix/controller-no-swaps
Mar 31, 2026
Merged

fix(asb, controller): get-swaps (use correct state, harden exchange rate calculation)#939
Einliterflasche merged 1 commit intomasterfrom
fix/controller-no-swaps

Conversation

@Einliterflasche
Copy link
Copy Markdown

There were two problems:

  • get-swaps assumed the first state of a swap is AliceState::Started, but that is not saved to the DB. Instead, BtcLockTransactionSeen is the first saved state.
  • Exchange rate calculation was fragile (floats, precision problem).

Fixes:

  • Assume BtcLockTransactionSeen instead of Started
  • Use decimals for exchange rate calculation

There were two problems:
 - get-swaps assumed the first state of a swap is `AliceState::Started`, but that is not saved to the DB.
   Instead, `BtcLockTransactionSeen` is the first saved state.
 - Exchange rate calculation was fragile (floats, precision problem).

Fixes:
 - Assume `BtcLockTransactionSeen` instead of `Started`
 - Use decimals for exchange rate calculation
@Einliterflasche
Copy link
Copy Markdown
Author

This should fix #930.

@binarybaron
Copy link
Copy Markdown

Assuming you have tested, LGTM!

@Einliterflasche Einliterflasche merged commit 92aad85 into master Mar 31, 2026
6 of 69 checks passed
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.

2 participants