Commit Graph

159 Commits

Author SHA1 Message Date
SomberNight
7294613447 util.is_hex_str: forbid whitespaces 2021-01-27 20:46:46 +01:00
SomberNight
1abecf25c9 qt block explorer: allow custom URL
The QTextEdit expects values such as (one per line):
```
https://blockstream.info/testnet/
https://192.168.0.38:3021/
("https://blockstream.info/testnet/", {'tx': 'tx/', 'addr': 'address/'})
```

closes #4831
2021-01-24 07:11:11 +01:00
SomberNight
d40bedb2ac also support uppercase bip21 URIs
related https://github.com/btcpayserver/btcpayserver/issues/2110
2020-12-09 16:09:12 +01:00
SomberNight
8c5601a172 dnspython: fix deprecation warnings when using dnspython 2.0
related: #6828
2020-12-09 09:04:04 +01:00
SomberNight
dbb7d7ce4d network: set _loop_thread again as it helps debugging
related: #6825
2020-12-08 11:48:01 +01:00
Stephan Oeste
a5acb7d695 add mempool.emzy.de
Same software as mempool.space other operator.
2020-11-22 01:43:47 +01:00
SomberNight
57768244bb qt history list: fix #6746 2020-11-18 23:50:08 +01:00
SomberNight
120da2783b util.randrange: use stdlib 'secrets' module instead of 'python-ecdsa' 2020-11-07 19:26:30 +01:00
SomberNight
c5da22a9dd network: tighten checks of server responses for type/sanity 2020-10-16 19:30:42 +02:00
bitromortac
193b17f0e4 util: move json_normalize to util 2020-09-24 07:32:18 +02:00
SomberNight
ea3e3ddbb8 lnpeer: handle cooperative close edge-case
fix #6317
2020-09-13 16:55:37 +02:00
SomberNight
5d723401f8 util.NetworkRetryManager: fix potential overflow
e.g. consider:
>>> 1.5 * 2 ** 2000
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: int too large to convert to float
2020-08-27 17:57:19 +02:00
SomberNight
36178df875 sql: test read-write permissions for given path and raise early
maybe fix #6485
2020-08-25 18:18:07 +02:00
Tigerix
8539beb75e Update util.py
Fixed Blockchain.com Testnet-URL
2020-07-05 12:59:09 +02:00
SomberNight
d19ff43266 interface: check server response for some methods
some basic sanity checks

Previously if the server sent back a malformed response, it could partially corrupt a wallet file.
(as sometimes the response would get persisted, and issues would only arise later when the values were used)
2020-07-02 15:41:39 +02:00
richard
b1a70be079 Add mempool.space option for mainnet block explorer (#6261)
* Add mempool.space

* Adds mempool.space testnet explorer

Didn't realize they had testnet as well - added
2020-06-25 17:00:20 +00:00
SomberNight
662d0d92bd remote watchtower: enforce that SSL is used, on the client-side 2020-06-24 16:57:50 +02:00
SomberNight
d5f368c584 LN invoices: support msat precision
fixes #6250
2020-06-22 22:48:13 +02:00
ThomasV
4bda882695 Group swap transactions in Qt history (fixes #6237)
- use tree structure of QTreeView
 - grouped items have a 'group_id' field
 - rename 'Normal' swap as 'Forward'
2020-06-22 11:26:49 +02:00
SomberNight
b6db201570 util: small clean-up for format_satoshis 2020-06-22 02:46:16 +02:00
SomberNight
2c962abe51 network: randomise the order of address subscriptions
Before this, we were subscribing to our addresses in their bip32 order,
leaking this information to servers. While this leak seems mostly harmless,
it is trivial to fix.
2020-06-17 19:25:52 +02:00
SomberNight
a32cb7784f myAiohttpClient: add id counter, and rename to JsonRPCClient 2020-06-09 17:50:06 +02:00
ThomasV
30f5be26ac Remove dependencies: jsonrpcserver, jsonrpcclient 2020-06-09 11:26:39 +02:00
ThomasV
56f4932f10 import/exports to json files:
- fix #5737
 - add import/export or requests
2020-06-05 13:17:01 +02:00
ThomasV
6058829870 Use attr.s classes for invoices and requests:
- storage upgrade
 - fixes #6192
 - add can_pay_invoice, can_receive_invoice to lnworker
2020-06-01 21:02:45 +02:00
SomberNight
54fdb011f9 fixups for CallbackManager refactor
9224404108
2020-04-24 15:32:05 +02:00
SomberNight
223b62554e lntransport: use network proxy if available
fixes #4824
2020-04-15 21:44:09 +02:00
SomberNight
7257172e1c NetworkRetryManager: add random noise to time 2020-04-15 17:24:10 +02:00
SomberNight
76f0ad3271 util: add NetworkRetryManager, a baseclass for LNWorker and Network 2020-04-15 17:24:07 +02:00
ThomasV
9224404108 Move callback manager out of Network class 2020-04-14 18:29:51 +02:00
SomberNight
fe86f91110 adapt to new aiohttp_socks: fix deprecation warnings
...\electrum\electrum\util.py:1096: DeprecationWarning: SocksConnector is deprecated. Use ProxyConnector instead.
  connector = SocksConnector(
...\Python38\site-packages\aiohttp_socks\proxy\socks5_proxy.py:37: DeprecationWarning: Parameter family is deprecated and will be ignored.
  super().__init__(
2020-04-13 05:00:26 +02:00
SomberNight
ea0981ebeb lnutil.UpdateAddHtlc: use attrs instead of old-style namedtuple 2020-03-17 20:31:11 +01:00
ThomasV
3d69f3b0be improve payment status callbacks:
- add 'computing route' status for lightning payments
 - use separate callbacks for invoice status and payment popups
 - show payment error and payment logs in kivy
2020-03-10 13:27:02 +01:00
SomberNight
7962e17df6 invoices: deal with expiration of "0" mess
Internally, we've been using an expiration of 0 to mean "never expires".
For LN invoices, BOLT-11 does not specify what an expiration of 0 means.
Other clients seem to treat it as "0 seconds" (i.e. already expired).
This means there is no way to create a BOLT-11 invoice that "never" expires.

For LN invoices,
- we now treat an expiration of 0, , as "0 seconds",
- when creating an invoice, if the user selected never, we will put 100 years as expiration
2020-03-04 14:24:07 +01:00
SomberNight
2fab681444 bolt11 invoice: strip (and so accept with) leading/trailing whitespaces 2020-03-02 19:32:53 +01:00
SomberNight
ed234d3444 rename all TaskGroup() fields to "taskgroup"
for consistency
2020-02-27 19:13:56 +01:00
Jakub Łukasiewicz
c121230706 Added ELECTRUMDIR env variable (#5543)
Simple way for allowing users to change localization of Electrum directory
from ~/.electrum to somewhere else
2020-02-25 15:28:53 +00:00
SomberNight
0723355a0f util.Satoshis: note that sometimes this actually has 'msat' precision 2020-02-17 16:52:25 +01:00
ThomasV
e3ccfe6449 kivy: make backups optional 2020-02-15 17:26:03 +01:00
SomberNight
497d6019e1 kivy/android: ask for STORAGE permission at runtime 2020-02-15 16:28:15 +01:00
ThomasV
2dad87cbb4 Automate backups:
- backup wallet file on each channel creation
 - on android, a backup password is entered in settings
 - on desktop, the backup path is in settings
2020-02-15 16:28:15 +01:00
ThomasV
87b7d2c0c0 wallet backup function for kivy/android 2020-02-15 16:28:15 +01:00
SomberNight
004acb906d ecc: abstract away some usage of python-ecdsa: randrange 2020-02-11 16:41:45 +01:00
ThomasV
dbceed2647 Restructure wallet storage:
- Perform json deserializations in wallet_db
 - use StoredDict class that keeps tracks of its modifications
2020-02-04 13:35:58 +01:00
SomberNight
6d270364c6 qt paytoedit: properly handle multiple max ('!') outputs 2020-01-18 04:15:44 +01:00
rbrooklyn
3658f87035 Add block explorer support for mynode.local (#5892) 2020-01-17 22:06:34 +00:00
SomberNight
2d57a689d9 network/util: increase default timeout of make_aiohttp_session (30->45s)
related: #5337
2020-01-01 06:21:20 +01:00
SomberNight
2ca535225d util.standardize_path: properly handle "~" (user's home directory)
notably this is needed when the shell itself does not get a chance to expand "~",
e.g. when a path is passed via JSON-RPC

>>> os.path.normcase(os.path.realpath(os.path.abspath("~/.electrum/testnet/wallets/delete_me2")))
'/home/user/wspace/electrum/~/.electrum/testnet/wallets/delete_me2'
>>> os.path.normcase(os.path.realpath(os.path.abspath(os.path.expanduser("~/.electrum/testnet/wallets/delete_me2"))))
'/home/user/.electrum/testnet/wallets/delete_me2'
2019-12-21 06:53:10 +01:00
SomberNight
7b49832a3f payment requests: fix explicit "None" expiration
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\main_window.py", line 994, in <lambda>
    self.create_invoice_button.clicked.connect(lambda: self.create_invoice(False))
  File "...\electrum\electrum\gui\qt\main_window.py", line 1123, in create_invoice
    key = self.create_bitcoin_request(amount, message, expiry)
  File "...\electrum\electrum\gui\qt\main_window.py", line 1132, in create_bitcoin_request
    addr = self.wallet.get_unused_address()
  File "...\electrum\electrum\wallet.py", line 1452, in wrapper
    addr = func(self, *args, **kwargs)
  File "...\electrum\electrum\wallet.py", line 1465, in get_unused_address
    addrs = self.get_unused_addresses()
  File "...\electrum\electrum\wallet.py", line 1459, in get_unused_addresses
    in_use_by_request = [k for k in self.receive_requests.keys() if self.get_request_status(k)[0] != PR_EXPIRED]
  File "...\electrum\electrum\wallet.py", line 1459, in <listcomp>
    in_use_by_request = [k for k in self.receive_requests.keys() if self.get_request_status(k)[0] != PR_EXPIRED]
  File "...\electrum\electrum\wallet.py", line 1535, in get_request_status
    if exp > 0 and time.time() > timestamp + exp:
TypeError: '>' not supported between instances of 'NoneType' and 'int'
2019-12-16 21:03:34 +01:00
SomberNight
308517d473 python 3.8: adapt to breaking changes re asyncio.CancelledError
(and TimeoutError)

closes #5798
2019-12-11 23:07:47 +01:00