You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
qml: only use QEAmount container instead of javascript/qml (q(u))int(64)
Using javascript or QML `int` type is a long-standing issue, as there is not enough range to express millisats or even sats.
A short summary of the issues:
- integers in javascript context have a max range of +/- 2^54-1, which allows 21M BTC expressed in sats, but not in msats.
- QML `int` properties have a max range of +/- 2^31-1, which only allows 21 BTC expressed in sats, 21 mBTC expressed in msats
- `int` parameters declared in the `pyqtProperty` and `pyqtSlot` decorators have a max range of 2^31-1,
although this is somewhat alleviated in the QML->Python direction by using `q(u)int64`. Returning a `q(u)int64` does not
work around the `int` limitation
In most of the QML code, `QEAmount` is already used for storing and passing around BTC values.
The only exception is where amounts are compared (e.g. invoice amount < available balance etc),
so the `<`, `>`, `<=`, `>=` and `!=` operators, and where these operators are implied, like `Math.min()` and `Math.max()`
This commit delegates these operators to python scope.
0 commit comments