Commit Graph

4409 Commits

Author SHA1 Message Date
djboi
604cba8fb6 Added different Sighash_Types (#7453)
Implements signing for sighash types other than `ALL` for segwit inputs.

fixes https://github.com/spesmilo/electrum/issues/7408
2021-09-07 14:41:50 +00:00
SomberNight
a39bfba2d9 ecc: allow tests to disable ecdsa R-value grinding
see https://github.com/spesmilo/electrum/pull/7453#issuecomment-912594926
2021-09-03 17:18:13 +02:00
bitromortac
ebc5954d61 fix ln payments: set payto_e ln invoice correctly
payto_e.lightning_invoice has to be set after the payment field is set
to the node pub key, because check_text has the side effect of resetting
the payto_e.lightning_invoice
2021-08-20 09:21:47 +02:00
Siddhant Chawla
e9f08ef69e Adding BumpFee command to the CLI (#7438)
closes https://github.com/spesmilo/electrum/issues/5791
2021-08-11 11:30:26 +00:00
bitromortac
e9a1bd1f1e kivy: fix on_intent to call set_URI 2021-07-30 09:47:43 +02:00
bitromortac
c65caf6c68 qt+android: add lightning URI support 2021-07-30 08:44:15 +02:00
bitromortac
6716004b47 bolt11: fix amount encoding for large values 2021-07-30 08:44:15 +02:00
SomberNight
55c988d540 Merge remote-tracking branch 'remotes/bitromortac-fork/2107-fix-self-payments' 2021-07-29 16:38:00 +02:00
bitromortac
4ee5fa75f6 lnrouter+lnworker: rename my_channels 2021-07-29 16:26:23 +02:00
ghost43
c24bb44554 Merge pull request #7433 from bitromortac/2107-fix-self-payments
lnrouter: fix self-payments
2021-07-29 16:25:36 +02:00
SomberNight
a1f69fef97 qt channels list: align "can send", "can recv" cols based on amounts 2021-07-28 15:29:23 +02:00
SomberNight
419d71b4ef (trivial) qt settings: fix a type hint
(no change in behaviour)
2021-07-28 15:29:20 +02:00
SomberNight
e7ccf1584e config: make adding thousand separators to amounts optional 2021-07-28 15:29:16 +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
bitromortac
e6ccbcf7b7 lnrouter: fix self-payments 2021-07-28 08:12:44 +02:00
Siddhant Chawla
a8ecc68833 Added BTC and Fiat amount on the confirmation screen for Lightning Invoice (#7425)
Added BTC and Fiat amount(as enabled by the user) on the confirmation screen for a Lightning Invoice in the Kivy GUI 

closes https://github.com/spesmilo/electrum/issues/7410
2021-07-22 18:23:32 +00:00
SomberNight
2881d1e62c kivy: fix: when changing units or ccy, history list was not updated
When changing e.g. from mBTC to BTC, the history list was only
partially updated: the displayed amounts got updated but the
displayed unit did not, so incorrect information was shown.
2021-07-21 20:34:05 +02:00
SomberNight
18c9a1af10 kivy: format_amount: minor clean-up 2021-07-21 18:35:06 +02:00
SomberNight
5891e039b1 config: add option to display amounts with msat precision 2021-07-20 20:35:44 +02: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
173225ae92 qt custom block explorer: fix handling non-str config values
fixes https://github.com/spesmilo/electrum/issues/7421

The config key can have non-str values (see line 367).
2021-07-20 16:54:40 +02:00
SomberNight
1f5a2df38d prepare release 4.1.5 2021-07-19 17:19:06 +02:00
MrNaif2018
aafa74ed08 Improve _mythread checks (#7403)
* Improve _mythread checks

* Create get_running_loop util
2021-07-15 14:52:25 +00:00
SomberNight
c5129ee447 follow-up prev 2021-07-15 01:47:26 +02:00
SomberNight
8481afb286 lnchannel: introduce HTLCWithStatus NamedTuple 2021-07-15 01:35:24 +02:00
SomberNight
8a56c9eb66 invoices: explain status constants 2021-07-15 01:33:11 +02:00
ghost43
cf7f66e9e6 Merge pull request #7399 from SomberNight/202107_wallet_request_status_event
wallet: fire "request_status" event also when conf number changes
2021-07-12 21:05:09 +02:00
ghost43
7d91e8144a Merge pull request #7395 from MrNaif2018/feat/lightning-cmd-tag
Add lightning tag for commands
2021-07-12 19:41:13 +02:00
SomberNight
d0f0669e8f crash reporter: send traceback for full chain of exceptions
Previously if there was a chain of exceptions, we were only
sending the traceback for the final exception.

E.g.
try:
    raise ExcOne("asdasd")
except ExcOne() as e:
    raise ExcTwo("qweqwe") from e

^ we would lose all info about ExcOne, including potentially many lines of trace
2021-07-12 19:24:58 +02:00
MrNaif2018
299214835f Add lightning tag for commands 2021-07-12 19:16:34 +03:00
ghost43
ee391a4932 Merge pull request #7396 from MrNaif2018/fix/jsonrpc-lockfile-cleanup
Don't cleanup lockfile if listen_jsonrpc is False
2021-07-12 18:12:09 +02:00
SomberNight
d94d443082 wallet: fire "request_status" event also when conf number changes 2021-07-11 16:57:01 +02:00
SomberNight
8945dcda7a qt init: on exc, let crash reporter appear instead of silently dying
related: https://github.com/spesmilo/electrum/issues/7390

```
20210706T091826.513398Z |    ERROR | __main__ | daemon.run_gui errored
Traceback (most recent call last):
  File "run_electrum", line 407, in handle_cmd
  File "electrum\daemon.py", line 584, in run_gui
  File "electrum\gui\qt\__init__.py", line 414, in main
  File "electrum\gui\qt\__init__.py", line 291, in wrapper
  File "electrum\gui\qt\__init__.py", line 316, in start_new_window
  File "electrum\gui\qt\__init__.py", line 361, in _start_wizard_to_select_or_create_wallet
  File "electrum\wallet_db.py", line 73, in __init__
  File "electrum\wallet_db.py", line 106, in load_data
  File "electrum\util.py", line 412, in <lambda>
  File "electrum\util.py", line 408, in do_profile
  File "electrum\wallet_db.py", line 175, in upgrade
  File "electrum\wallet_db.py", line 540, in _convert_version_24
ValueError: too many values to unpack (expected 2)
```
2021-07-07 19:19:43 +02:00
MrNaif2018
c35a46a727 Don't cleanup lockfile is listen_jsonrpc is False 2021-07-07 16:57:09 +03:00
SomberNight
7236dae94b kivy wizard: add explicit warnings at seed creation 2021-07-05 19:40:02 +02:00
SomberNight
82bfe1ba9c kivy crash reporter: warn users not to share sensitive info
Previously only Qt had the warning.
2021-07-05 18:59:02 +02:00
SomberNight
6a049d9901 wallet: make sure payment requests are persisted
Fixes: after adding a payment request, if the process was killed,
the payreq might get lost. In case of using the GUI, neither the
callee nor the caller called wallet.save_db().

Unclear where wallet.save_db() should be called...
Now each method tries to persist their changes by default,
but as an optimisation, the caller can pass write_to_disk=False
e.g. when calling multiple such methods and then call wallet.save_db() itself.

If we had partial writes, which would either rm the need for wallet.save_db()
or at least make it cheaper, this code might get simpler...

related: https://github.com/spesmilo/electrum/pull/6435
related: https://github.com/spesmilo/electrum/issues/4823
2021-07-05 18:39:10 +02:00
ghost43
f49db86ea8 Merge pull request #7385 from BamaHodl/master
Friendlier minimum sizing for small screens for air-gapped signing
2021-07-05 17:44:20 +02:00
SomberNight
cfdadeda67 qt: some fixes for send/receive tabs when window is small 2021-07-05 17:26:29 +02:00
SomberNight
a339338958 LN private route hints: don't include low receive capacity channels
see code comment.

While the balance in the channels might shift before the sender tries to
pay the invoice, as we are not a forwarding node, that seems unlikely to matter.
2021-07-02 19:52:36 +02:00
SomberNight
04bc7fd28f trampoline: fix "pay-to-legacy" workaround when using ACINQ node
It is the last Trampoline Forwarder that should be checked, not the
first one.

Consider route (of Trampolines only):
Alice-electrum -> T_ACINQ -> T_Hodlister -> Bob-electrum
Even if Bob has a transport open with ACINQ or even if Bob has a channel open with ACINQ,
Alice can safely use end-to-end trampoline for this route: ACINQ will not know who
the recipient is, so they will not try to do pay-to-open (and hold up the payment for minutes...).

related: https://github.com/ACINQ/lightning-kmp/pull/237
2021-07-02 19:42:58 +02:00
BamaHodl
ea19b665ff Friendlier minimum sizing for small screens for air-gapped signing functionalities, i.e. main window and transaction dialog 2021-07-02 12:04:41 -05:00
SomberNight
3a7f5373ac trampoline: improve payment success
- better error handling: previously we stopped all attempts on any of
  TRAMPOLINE_EXPIRY_TOO_SOON, UNKNOWN_NEXT_PEER, TEMPORARY_NODE_FAILURE.
  Instead we should retry (but see code comments).
- previously payments failed if ALL of the following criteria applied:
  - sender is paying via trampoline, but not via the ACINQ node (which is
    special cased)
  - receiver only has private channels and has put r_tags into invoice, along
    with setting the trampoline feature bit in the invoice, however the receiver
    is not connected to any trampoline forwarders directly
  The sender would then assume that the private routing hints in the invoice
  correspond to trampoline forwarders.
- also, previously if both the sender and the recipient used trampoline and
  they shared a trampoline forwarder (that they were both connected to), the
  private channels the recipient had (with nodes other than the shared TF)
  would never be attempted.
2021-07-02 18:44:39 +02:00
SomberNight
215734c3de qr scanning: add comments to distinguish qrscanner.py and qrreader/ 2021-06-25 17:40:23 +02:00
SomberNight
013cf869f1 qt: qrreader: keep both old and new toolchain; try to abstract it away 2021-06-25 16:52:02 +02:00
SomberNight
c1dbcab9bb qt: new qrreader using QtMultimedia; drop CalinsQRReader(mac)
This commit ports the work of EchterAgo and cculianu from Electron-Cash,
to implement a new toolchain to scan qr codes.

Previously, on Linux and Win, we have been using zbar to access the camera
and read qrcodes; and on macOS we used CalinsQRReader (an objective-C
project by cculianu).

The new toolchain added here can use QtMultimedia to access the camera,
and then feed that image into zbar. When used this way, zbar needs
fewer dependencies and is easier to compile, in particular it can be
compiled for macOS.

The new toolchain works on all three platforms, with some caveats
(see code comments in related commits) -- so we also keep the end-to-end
zbar toolchain; but at least we can drop CalinsQRReader.

The related changes in Electron-Cash are spread over 50+ commits (several PRs and direct
pushes to master), but see in particular:
https://github.com/Electron-Cash/Electron-Cash/pull/1376

some other interesting links:
b2b737001c
163224cf1f
3b31e0fcb1
eda015908e
https://github.com/Electron-Cash/Electron-Cash/pull/1545
052aa06c23
2021-06-25 16:51:58 +02:00
SomberNight
129d5ba417 qt: (fix) make ScanQRTextEdit inherit Logger
the error handling in `qr_input()`, around line 81,
references `self.logger`, which would raise
2021-06-25 16:50:52 +02:00
SomberNight
bc5ec96387 kivy: scan_qr_non_android: handle user closing window
handle user closing window without scanning a qr code
(i.e. cancelling scan)
2021-06-25 16:44:39 +02:00