1
0
Commit Graph

24 Commits

Author SHA1 Message Date
SomberNight
12a81c1a34 tests: add tests for util.age 2023-04-16 22:43:34 +00:00
SomberNight
72da9c1a6a sanitise untrusted error bytes before logging it
full-blown paranoia kicking in
2023-04-06 14:28:31 +00:00
SomberNight
21c18bbbe7 util.parse_URI: honour docstring and only raise InvalidBitcoinURI
follow-up ac1d53f067
2022-11-03 12:47:21 +00:00
SomberNight
ac1d53f067 util.parse_URI: allow bip21 with lightning key without fallback addr
We would reject bip21 URIs that contained both an "address=" and a "lightning=" key with a bolt11 invoice,
where the bolt11 invoice did not contain a fallback address.
2022-10-31 19:03:12 +00:00
SomberNight
01b5e3f8e0 flake8: enable more mandatory tests 2022-10-31 16:13:22 +00:00
SomberNight
233d2373df util: implement is_subpath 2022-08-09 18:48:21 +02:00
SomberNight
9f5370f9c6 util.format_satoshis: fix (add_thousands_sep & whitespaces) param combo 2021-07-28 15:29:12 +02:00
djboi
6a431aab8c Fixed issue with thousands separator for better readability (#7427)
util.format_satoshis: introduce new option to add thousands separators
2021-07-28 13:26:30 +00:00
SomberNight
46badd128e util.format_satoshis: fix whitespaces param for non-zero precision 2021-07-20 20:31:48 +02:00
SomberNight
5c80293696 util.format_satoshis: fix for amounts with higher than sat precision
Previously, msat precision was leaking through format_satoshis if the
user's base unit was set to "sat". This was a bug.
Some features of format_satoshis did not work well with such values, such
as the "whitespaces" param.

Old code:

>>> util.format_satoshis(Decimal('45831275.748'), decimal_point=2)
'458312.76'
>>> util.format_satoshis(Decimal('45831275.748'), decimal_point=0)
'45831275.748'

New code:

>>> util.format_satoshis(Decimal('45831275.748'), decimal_point=2)
'458312.76'
>>> util.format_satoshis(Decimal('45831275.748'), decimal_point=0)
'45831276.'
2021-07-20 20:02:45 +02:00
SomberNight
eb6b4580e8 fix tests: adapt to breaking change of ipaddress.ip_address in py3.9.5
fixes https://github.com/spesmilo/electrum/issues/7307

We can simply remove that test as we don't actually care whether the
leading zeroes are allowed.

see 60ce8f0be6
see https://bugs.python.org/issue36384
2021-06-05 08:01:38 +02:00
SomberNight
7294613447 util.is_hex_str: forbid whitespaces 2021-01-27 20:46:46 +01:00
SomberNight
c5da22a9dd network: tighten checks of server responses for type/sanity 2020-10-16 19:30:42 +02:00
SomberNight
662d0d92bd remote watchtower: enforce that SSL is used, on the client-side 2020-06-24 16:57:50 +02:00
SomberNight
b6db201570 util: small clean-up for format_satoshis 2020-06-22 02:46:16 +02:00
SomberNight
db84de5493 trivial: use "chunks()" for htlc_sigs in lnchannel 2020-03-30 02:46:25 +02:00
SomberNight
04edad9984 config: no longer singleton. it is passed to Wallet.__init__
The few other cases that used SimpleConfig.get_instance() now
either get passed a config instance, or they try to get a reference
to something else that has a reference to a config.
(see lnsweep, qt/qrcodewidget, qt/qrtextedit)
2019-09-22 20:46:01 +02:00
SomberNight
bc06ded4b9 persist nodes in channel_db on disk 2019-08-20 09:03:10 +02:00
SomberNight
30ffb3d4dc util: add function "chunks"
taken from ElectrumX
67111a3c4c/electrumx/lib/util.py (L149)
2019-05-26 04:10:32 +02:00
SomberNight
38ab7ee554 network: catch untrusted exceptions from server in public methods
and re-raise a wrapper exception (that retains the original exc in a field)

closes #5111
2019-02-12 17:02:15 +01:00
SomberNight
7c4d6c6801 fix #4771 2018-10-13 04:22:53 +02:00
SomberNight
5afdc14913 util: small clean-up re format_satoshis
related #4771
2018-10-13 04:21:07 +02:00
Dzhelil Rufat
c9ffffc526 Remove unneccessary imports from the unit testing directory. (#4699) 2018-09-08 17:24:23 +02:00
Janus
097ac144d9 file reorganization with top-level module 2018-07-13 14:01:37 +02:00