millisat precision#10586
Conversation
ce4fb8e to
eda429f
Compare
62db370 to
d8dfce5
Compare
d8dfce5 to
102df84
Compare
102df84 to
f7d2a9e
Compare
| """Formats amount as string, converting to desired unit. | ||
| E.g. 500_000 -> '0.005' | ||
| """ | ||
| return self.config.format_amount( |
There was a problem hiding this comment.
Well, 5891e03 introduced a config option whether to show msat precision or not. format_amount just takes this into account.
QML bypasses this by using Config.formatMilliSats where msat precision is used, which explicitly passes the requested msat precision.
I'm fine with reverting 5891e03 though, I think for bitcoin amounts you almost always want to see full precision..
|
I looked through the PR, but the issues above were all found by Claude. For those i verified (point 1 - 6) i wrote the comments above. I didn't verify the remaining points but considering the first were all real it makes sense to look at the remaining ones as well (8. -12.). This is the output:## 🔴 High — confirmed crashes / broken core flows1.
|
754820c to
19432c7
Compare
Thanks for reviewing. I missed these Claude findings due to the green checkmark, and cirrus-ci is by now unavailable.. |
The results i commented were from a local run, not sure what the CI said, but yeah it often finds some things even though the checkmark is green, so makes sense to look at the output anyway. |
SomberNight
left a comment
There was a problem hiding this comment.
I just looked at the first commit.
Please don't think just because the genai finds no concerns, there are no bugs.
Hmm, don't mind if I do :) |
…imal point and extra_precision up to AmountEdit AmountEdit defaults to decimal_point = 0, declare FiatAmountEdit to encapsulate fx base unit and precision, extra_precision now a callable and retrieved dynamically. BTCAmountEdit extended with millisat_precision option kwarg to allow 3 digits extra precision.
…with parameter combinations to constructor. in QEConfig, add formatMilliSatsForEditing, update formatMilliSats passing Decimal to config.format_amount/_and_units
add amount_msat parameter and make mutually exclusive with amount_sat
qt: send_tab LN checks millisat precision
payment_identifier: mark pi invalid if multiline and any output uses msat precision qt: update send_tab for lnurl msat precision qml: update qeinvoice, qerequestdetails for lnurl msat precision
…oiceParser, QEFX, QEWallet
QEConfig.satsToUnits to QEConfig.amountToBaseunitStr with the latter now also taking a QEAmount instance
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.
…precision on send_tab if recipient is onchain
19432c7 to
40a169a
Compare
|
rebased on master, commits reorganised for better reviewability |
be0695d to
5f13e7b
Compare


support millisat precision throughout the codebase.
ints are passedDecimalis used on the GUI side where it's easier to assume sats are the base unitsatandmsatfields/parametersQEAmountis now synced between sats and millisats, simplifying assumptions and reducing if-else checksshould fix #6253, #10412