1
0

invoices: also run amount-validator on setter

- @amount_msat.validator prevents the creation of invoices with e.g. too large amounts
- however the qml gui is mutating invoices by directly setting the `amount_msat` field,
  and it looks like attrs validators only run during init.
  We can use `on_setattr` (introduced in attrs==20.1.0).
- a wallet db upgrade is added to rm existing insane invoices
- btw the qml gui was already doing its own input validation on the textedit
  (see qeconfig.btcAmountRegex). however that only limits the input to not have more
  chars than what is needed to represent 21M BTC (e.g. you can still enter 99M BTC,
  which the invoice logic does not tolerate later on - but is normally caught).

fixes https://github.com/spesmilo/electrum/issues/8582
This commit is contained in:
SomberNight
2023-08-22 18:10:21 +00:00
parent 7245762922
commit 4e6e6f76ca
4 changed files with 68 additions and 8 deletions

View File

@@ -6,7 +6,7 @@ aiohttp>=3.3.0,<4.0.0
aiohttp_socks>=0.3
certifi
bitstring
attrs>=19.2.0
attrs>=20.1.0
# Note that we also need the dnspython[DNSSEC] extra which pulls in cryptography,
# but as that is not pure-python it cannot be listed in this file!