mirror of
https://github.com/Such-Software/wowcheckout.git
synced 2026-12-02 12:33:58 +01:00
fix: Wownero atomic unit is 10^11, not 10^12
The codebase was forked from xmrcheckout and kept Monero's 10^12 atomic-unit constant everywhere. Wownero uses 11 decimal places, not 12. Effect: _xmr_to_atomic(amount) produced a required_atomic value 10× larger than what wallet-rpc actually reports for the subaddress. Invoices flagged total_paid_atomic correctly (that comes from the daemon) but is_paid = total_paid >= required was always false, so the reconciler never flipped status pending → payment_detected, webhook never fired, Medusa never saw the payment. Fix all four places: reconciler._xmr_to_atomic, btcpay_routes._xmr_to_atomic, btcpay_routes._atomic_to_xmr, btcpay_routes._format_xmr_fixed, routes.py invoice-status response. Extracted a WOW_ATOMIC_UNITS constant so this doesn't get lost again when we touch these files.
This commit is contained in:
@@ -417,8 +417,16 @@ def _safe_update_reconciler_status(
|
||||
|
||||
|
||||
|
||||
# Wownero uses 11 decimal places (atomic unit = 10^-11 WOW), NOT 12 like
|
||||
# Monero. Using 10^12 here makes required_atomic 10× larger than actual paid
|
||||
# amount, so is_paid never becomes true and invoices stay pending forever
|
||||
# even after detection + confirmations. This entire codebase was forked from
|
||||
# xmrcheckout and the constant must be corrected wherever it appears.
|
||||
WOW_ATOMIC_UNITS = Decimal("100000000000") # 10^11
|
||||
|
||||
|
||||
def _xmr_to_atomic(amount: Decimal) -> int:
|
||||
quantized = (Decimal(amount) * Decimal("1000000000000")).to_integral_value(
|
||||
quantized = (Decimal(amount) * WOW_ATOMIC_UNITS).to_integral_value(
|
||||
rounding=ROUND_DOWN
|
||||
)
|
||||
return int(quantized)
|
||||
|
||||
Reference in New Issue
Block a user