Commit Graph

13411 Commits

Author SHA1 Message Date
SomberNight 7d7dcf0795 qt/kivy ChannelsList: if node alias is unknown, display node id
instead of "unknown"
2021-03-01 16:41:54 +01:00
SomberNight dd37151d65 qt ChannelsList: (trivial) format_fields should not know column order 2021-03-01 16:28:18 +01:00
SomberNight bf7129d57e synchronizer/verifier: ensure fairness between wallets (follow-up)
follow-up to https://github.com/spesmilo/electrum/commit/4346d2fc765f40a9388108c06cf1ee132d663923

It's not just about the Synchronizer, the Verifier should not starve other jobs either...
(previously I thought the Verifier is not too important as it only makes
requests if there are new txs; however with LNWatcher its progress is not persisted)
2021-03-01 13:08:01 +01:00
SomberNight e0cfb2179d bech32: another around 10% speedup for bech32_decode
turns out stdlib ord() is somewhat slow;
also, only lookup data chars once

benchmarked with:
```
import time
import electrum
from electrum.segwit_addr import bech32_decode

electrum.constants.set_testnet()

inv = "lntb4m1p00zfpppp597ely08ffhk8n3emeswukt0y3qfvt3sj3ufkhnaatlrswj2xvwuqsp5vu3ezu44ka8arvgda44yalysp3k3edlvg56cjkk5lvu4e4anmdssdq2v9ekgctnvscqzynxqyz5vq9qypqsqrzjqv8shunq4nda8mw2mpxhtz8v03wlgug7sln2yvqklxym35ayz3erqxct8vqqqcqqqqqqqqlgqqqqqqgq9qrzjqdxvvgt048y4htef7r63r4ha9kctz3d6l3za0053ahe597wgrkc4gxct8cqqqfsqqqqqqqlgqqqqqqgq9qrzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmjxct8vqqqdcqqqqqqqlgqqqqqqgq9qrzjqf56jn5txtqqtepnd0ahg0qg5m5mavfajsx403rem9wgu6rue0de7xct8vqqqtgqqqqqqqlgqqqq86qq9qrzjq027z73uyyl7fy8pkrpcn7x0el82pz3fw974p2052de4uz4j5lqqxx49tuqqqwgqqqqqqqqqqqqqqqqqpurzjqfj34n62wztqjxl59w4drxekg04rrrtf08mdestwhtky84ds7ja0yxct8sqqq3qqqqqqqqlgqqqqqqgq9qrzjqd872t5c5r5a8ssmwelpkdccsyn9mrr40rpp7khad4jr3kssxj9nvx49vgqqqnqqqqqqqqlgqqqq05qqgcxwu0ervh6atmqmqv7pmenhmc207gncyj0mcxedpwm8f56y2yl3qpq6mzjak37ddmeayd9unektmffv5rq8dvlpgq00rmmdalda73yhgqep0zuz"

def f():
  for _ in range(10000):
    addr = bech32_decode(inv, ignore_long_length=True)

t0 = time.time()
f()
t1 = time.time()
print(f"{t1-t0:.4f}")
```
2021-02-28 18:32:48 +01:00
SomberNight b83f7159a9 bech32: around 5% speedup for bech32_decode
useful for lnaddr.lndecode
2021-02-28 16:53:21 +01:00
SomberNight d7597d96d0 lnaddr: 15x speedup for lndecode
benchmarked with:

```
import time
import electrum
from electrum.lnaddr import lndecode

electrum.constants.set_testnet()

inv = "lntb4m1p00zfpppp597ely08ffhk8n3emeswukt0y3qfvt3sj3ufkhnaatlrswj2xvwuqsp5vu3ezu44ka8arvgda44yalysp3k3edlvg56cjkk5lvu4e4anmdssdq2v9ekgctnvscqzynxqyz5vq9qypqsqrzjqv8shunq4nda8mw2mpxhtz8v03wlgug7sln2yvqklxym35ayz3erqxct8vqqqcqqqqqqqqlgqqqqqqgq9qrzjqdxvvgt048y4htef7r63r4ha9kctz3d6l3za0053ahe597wgrkc4gxct8cqqqfsqqqqqqqlgqqqqqqgq9qrzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmjxct8vqqqdcqqqqqqqlgqqqqqqgq9qrzjqf56jn5txtqqtepnd0ahg0qg5m5mavfajsx403rem9wgu6rue0de7xct8vqqqtgqqqqqqqlgqqqq86qq9qrzjq027z73uyyl7fy8pkrpcn7x0el82pz3fw974p2052de4uz4j5lqqxx49tuqqqwgqqqqqqqqqqqqqqqqqpurzjqfj34n62wztqjxl59w4drxekg04rrrtf08mdestwhtky84ds7ja0yxct8sqqq3qqqqqqqqlgqqqqqqgq9qrzjqd872t5c5r5a8ssmwelpkdccsyn9mrr40rpp7khad4jr3kssxj9nvx49vgqqqnqqqqqqqqlgqqqq05qqgcxwu0ervh6atmqmqv7pmenhmc207gncyj0mcxedpwm8f56y2yl3qpq6mzjak37ddmeayd9unektmffv5rq8dvlpgq00rmmdalda73yhgqep0zuz"

def f():
  for _ in range(100):
    addr = lndecode(inv)

t0 = time.monotonic()
f()
t1 = time.monotonic()
print(f"{t1-t0:.4f}")
```
2021-02-28 16:26:15 +01:00
SomberNight 2b693d3498 tests: fix test_lnpeer.test_payment_race
broke in https://github.com/spesmilo/electrum/commit/b6b13217b4929c5701e18a1310b20caf01fb61e5
see changes to lnworker.htlc_fulfilled
2021-02-28 13:58:31 +01:00
ThomasV bc1ec6ac34 Qt: fix running GUI offline 2021-02-28 13:34:24 +01:00
ThomasV 5175a97671 test_payment_race: increase delay 2021-02-28 09:43:46 +01:00
ThomasV f32d49b8ca revert 'keep invoice INFLIGHT', check HTLCs before payment attempt 2021-02-28 09:01:31 +01:00
ThomasV 38652cffb0 fix test_lnpeer (follow-up prev commit) 2021-02-27 20:51:19 +01:00
ThomasV b6b13217b4 lnworker: keep invoice status INFLIGHT as long as HTLCs are inflight 2021-02-27 20:26:58 +01:00
SomberNight 2f223cdf46 qt channels dialog: fix for channel backups 2021-02-27 15:15:09 +01:00
SomberNight d85e910262 logging: eliminate "fee_estimates" log spam
only log fee estimates if they changed, instead of ~10 times per minute
2021-02-27 12:27:26 +01:00
ThomasV 7f61f22857 MPP receive: allow payer to retry after mpp timeout 2021-02-27 11:48:14 +01:00
ghost43 0ce6adffcc Merge pull request #6968 from HardCorePawn/issue6664
Added fiat fee estimate to Advanced Preview
2021-02-27 08:31:17 +00:00
SomberNight f9f49daad7 tx dialog: uniform high fee warnings between GUIs 2021-02-26 19:02:24 +01:00
SomberNight fc3009918c follow-up prev: some clean-up 2021-02-26 16:44:07 +01:00
hcp e01a2014b1 qt tx dialog: also display fiat amounts 2021-02-26 16:43:46 +01:00
SomberNight 84326cf1f7 qt tx dialog: add legend for input/output colouring
based on https://github.com/Electron-Cash/Electron-Cash/commit/e1d70bcd98de8ae48f01b63f50660edb364fe0d0
2021-02-25 18:54:55 +01:00
ghost43 6fda9add28 Merge pull request #7026 from SomberNight/20210213_wallet_bumpfee
wallet: refactor bump_fee; add new strategy; change Qt dialog to have "advanced" button
2021-02-25 14:48:50 +00:00
SomberNight d2019fd928 qt bump fee: rename "Final" checkbox to "Keep Replace-By-Fee enabled"
Now that the checkbox is hidden behind an advanced option, there is
no need to be brief about it, better to be explicit.
(terminology unchanged for kivy.)
2021-02-25 15:39:33 +01:00
SomberNight 4c36c45664 qt bump fee: add "advanced" button, allow choosing strategy 2021-02-25 15:39:29 +01:00
SomberNight 058d9ab6bb wallet.bump_fee: add new strategy: decrease payment amounts
- Rename bump_fee "methods" to "strategies".
- Refactor strategies so that bump_fee can use any subset of them in any permutation.
- Adds a new strategy which decreases the payment outputs (instead of change).
2021-02-25 15:32:07 +01:00
SomberNight 8fe7d750f7 qt: move RBF dialog out of main_window.py into its own file 2021-02-25 15:32:03 +01:00
SomberNight 254f57bce5 lnpeer.maybe_fulfill_htlc: fix error case FINAL_INCORRECT_HTLC_AMOUNT
follow-up ef5a265449
2021-02-25 12:49:06 +01:00
SomberNight 31bdb5c344 lnpeer.maybe_fulfill_htlc: follow BOLTs re some errors
related: https://github.com/lightningnetwork/lightning-rfc/pull/608
2021-02-25 12:12:44 +01:00
ThomasV 61e7f7e75e Merge pull request #7065 from SomberNight/20210224_mpp_recv_amt_sum
lnpeer: MPP recv: only fulfill htlc if amt sum exact-matches total_msat
2021-02-25 10:27:55 +01:00
ThomasV 5dc7b5bffe Merge pull request #7069 from bitromortac/2102-mpp-split-params
mpp_split: optimize split parameters
2021-02-25 10:26:01 +01:00
bitromortac bf87169469 mpp_split: tweak split parameters
Increases STARTING_CONFIGS to sample more starting configurations.
Reduces CANDIDATES_PER_LEVEL to reduce computational effort.
Increases REDISTRIBUTE.

The time it takes for a typical suggest_split call is about 2 msec a
desktop machine.
2021-02-25 08:37:39 +01:00
bitromortac 5081a83245 mpp_split: undo side effect in tearDown 2021-02-25 08:37:07 +01:00
SomberNight 16f0b30ced lnpeer: MPP recv: only fulfill htlc if amt sum exact-matches total_msat 2021-02-24 20:51:58 +01:00
SomberNight 9024419fdc lnpeer: MPP receive: require payment_secret for each htlc
BOLT-04 says:
The final node:
  if it supports basic_mpp:
    MUST require payment_secret for all HTLCs in the set

https://github.com/lightningnetwork/lightning-rfc/blob/90468030d5c374ced568c91df5d37699fe020010/04-onion-routing.md#basic-multi-part-payments
2021-02-24 20:34:34 +01:00
SomberNight 691ebaf4f8 lnworker/lnpeer: add some type hints, force some kwargs 2021-02-24 20:03:12 +01:00
SomberNight d800f88bfc (trivial) wallet: fix over-indentation 2021-02-24 19:01:02 +01:00
ThomasV c9d6d11604 create_trampoline_route: check that we can pay the amount and the fees, and that the route is sane 2021-02-24 18:25:49 +01:00
SomberNight ab9bf07a79 (trivial) lnrouter: fix type of TrampolineEdge.short_channel_id
also, use keyword arguments inside attr.ib() as PyCharm was complaining
2021-02-24 16:46:59 +01:00
ThomasV bf1d516959 lnworker: add fees from private path to the amount passed to find_route.
(see #7050)
2021-02-24 16:32:08 +01:00
ThomasV 391dba7117 Refactor find_route_for_payment
- remove duplicated code
 - rename variable names to be consistent with the
'path', 'route' terminology
 - compute private route before route
2021-02-24 16:26:53 +01:00
ThomasV 152894e6a9 calc_hops_data: total_msat should be optional 2021-02-24 16:14:19 +01:00
SomberNight 0a5b714643 lnworker: add "endurance" ACINQ testnet node as hardcoded trampoline 2021-02-24 13:38:04 +01:00
SomberNight 52eb9dcad9 tests: fix thinko in ElectrumTestCase base class
can't see why it was cross-calling the setUpClass from the
individual test setUp
2021-02-24 13:32:29 +01:00
SomberNight a9d0e3fca9 tests: try to eliminate random failures from mpp_split tests
closes: #7062
2021-02-24 12:54:43 +01:00
SomberNight 228c4b4597 synchronizer: better handle history-status mismatch
When receiving the history of an address, the client behaved unexpectedly
if either of two checks failed.
The client checked that the txids in the history are unique, and that the
history matches the previously announced status. If either failed, it
would just log a line and do nothing. Importantly, the synchronizer could
even consider itself is_up_to_date, i.e. the GUI could show the wallet is
synced.

This is now changed such that:
- if the txid uniqueness test fails, we simply disconnect
- if the history is not consistent with previously announced status,
  we wait a bit, make sure is_up_to_date is False in the meantime,
  and then potentially disconnect
See rationale for these in the comments.

related: https://github.com/spesmilo/electrum/issues/7058#issuecomment-783613084
2021-02-24 12:32:54 +01:00
SomberNight 4a8286c744 qrscanner: nicer error messages 2021-02-23 22:38:53 +01:00
ThomasV 22a14d42b2 Merge pull request #7061 from zebra-lucky/add_kivy_scan_qr_non_android
kivy: add app.scan_qr_non_android
2021-02-23 12:03:13 +01:00
zebra-lucky f6011dc31a kivy: add app.scan_qr_non_android 2021-02-23 12:51:23 +02:00
ThomasV 10611876ee qt: update swap button together with can_send 2021-02-23 10:58:21 +01:00
ThomasV 618b008c54 Merge pull request #7060 from bitromortac/mpp-test-fix
mpp_split: fix tests for python versions < 3.8
2021-02-23 10:23:35 +01:00
bitromortac 9b0b78eca1 mpp_split: fix tests for python versions < 3.8 2021-02-23 08:02:02 +01:00