Commit Graph

4045 Commits

Author SHA1 Message Date
ThomasV 308b02ca7d lnworker: fix amount in htlc_log after mpp bucket failure 2021-03-08 17:23:52 +01:00
ThomasV 5df4466812 rm fixme; it was for intermediate stage, between commits. 2021-03-08 13:30:59 +01:00
SomberNight edb214aeca lnworker.pay_to_node: re overpayment, raise before actually it happens 2021-03-06 14:23:00 +01:00
ThomasV 6ddd02506e test_lnpeer: add missing parameter in pay_to_route 2021-03-06 10:59:29 +01:00
ThomasV 83993768e5 trampoline: do not add node in trampoline hints if it already is
the last trampoline of the route
2021-03-06 10:46:58 +01:00
ThomasV 5663e59863 lnworker: fix amount_inflight.
(amount with routing fees were used on htlc failures)
2021-03-06 10:46:40 +01:00
ThomasV d3d476f44c lnpeer: fix error code in logs 2021-03-06 00:31:30 +01:00
ThomasV 31919d0425 lnworker: add assert amount_inflight <= amount_to_pay 2021-03-06 00:29:37 +01:00
SomberNight 529e96aaf9 synchronizer: (trivial) add comment 2021-03-05 21:04:20 +01:00
SomberNight 1dbff51fce synchronizer: fix rare race where synchronizer could get stuck 2021-03-05 20:46:41 +01:00
SomberNight 34413a9c30 python 3.6 compat: asyncio.Task.set_name was added in 3.8 2021-03-05 20:11:54 +01:00
ThomasV 5207c40cc3 fix trampoline forwarding: add_received_htlc must be indexed by payment_secret 2021-03-05 17:04:26 +01:00
ThomasV 59547d0513 test_lnpeer: variables must be declared in MockLNWallet.__init__ 2021-03-05 17:04:26 +01:00
SomberNight 762ebb12b2 lnpeer: increase max_accepted_htlcs (5->30)
Counter-intuitively, the motivation is to be able to *send* more htlcs,
for MPP trickery. We don't offer more htlcs than this limit, to be
conservative with what we send, and to interoperate with clightning.

defaults of other clients:
eclair: 30
clightning: 30
lnd: 483
2021-03-05 16:12:01 +01:00
ThomasV f397b315ac remove trampoline and forwarding regtests, as they are covered by unittests 2021-03-05 13:18:44 +01:00
ThomasV 1f60d5d8ee test_lnpeer: add test for trampoline 2021-03-05 13:00:24 +01:00
ThomasV eda9097e89 trampoline forwarding: return UNKNOWN_NEXT_PEER if we cannot find a route 2021-03-05 12:47:18 +01:00
ThomasV 6cc3480356 follow-up prev commit 2021-03-05 10:23:00 +01:00
ThomasV 16554afa1b follow-up previous commit (this was for testing) 2021-03-05 10:14:26 +01:00
ThomasV 2e4f45ec74 use two trampolines: fix blacklisting, use local variables for trampoline_fee_level and use_two_trampolines 2021-03-05 10:07:02 +01:00
SomberNight ec6baa12f8 follow-up prev
oops, that was just for local testing
2021-03-04 17:50:52 +01:00
SomberNight 064670bd75 network: close interfaces more aggressively (abort after 2 seconds)
fixes #7083
2021-03-04 17:47:49 +01:00
SomberNight ff485cee62 use functools.wraps() for some wrappers
to help debugging
2021-03-04 16:44:13 +01:00
SomberNight 859f8ccf8e fix wallet.clear_history()
it would result in "wallet.get_history() failed balance sanity-check"

maybe related: https://github.com/spesmilo/electrum/issues/6792
2021-03-04 14:25:41 +01:00
ThomasV 5a2a724cb9 Receive MPP: Use persisted payment status to decide whether to
fulfill HTLCs. Without this commit, we might timeout a part of
a payment if the client is shut down before all parts are
fulfilled.
2021-03-04 14:11:55 +01:00
SomberNight e25602ab3b wallet: don't put partial tx as UTXO into psbt
if there is a chain of unsigned txs, we cannot populate NON_WITNESS_UTXO

closes #7080
closes #7009
closes #6482
2021-03-04 13:20:49 +01:00
SomberNight 785fe6aeea lnutil: (trivial) add ShortChannelID.from_str() method
for console use atm
2021-03-04 12:14:47 +01:00
ThomasV 738411e32b Trampoline forwarding:
- fix regression in create_routes:
   fwd_trampoline_onion was not added to the tuple
 - fix onion structure for e2e
 - maybe_fulfill_htlc:
   check the mpp_status of the outer onion,
   return trampoline_onion to be forwarded
2021-03-04 11:46:31 +01:00
ThomasV ba4d6bc8b3 trampoline MPP: fix total_msat in trampoline onion, and bucketing 2021-03-04 10:05:09 +01:00
ThomasV 253907fb60 lnworker: move buckets logic inside first branch of if statement (refactoring commit) 2021-03-04 08:50:22 +01:00
SomberNight f84f13529a lnhtlc: fix deadlock 2021-03-03 22:05:09 +01:00
SomberNight adbfb2dcc8 lnworker.pay_to_node: (fix) pass correct total_msat to pay_to_route 2021-03-03 20:35:48 +01:00
SomberNight 920e1e94fa kivy: InvoiceDialog: make LN invoice QR code scannable
Don't show the text and the QR code together, only the QR code:
the text takes up too much space, which make the QR hard to scan.
2021-03-03 17:31:08 +01:00
SomberNight 1aec982b27 kivy: SendScreen: reliably show LN payment attempt progress for invoice 2021-03-03 16:57:54 +01:00
ThomasV 7ca64ebbd8 fix #7078 2021-03-03 15:35:38 +01:00
SomberNight 95b7c976e0 lnrouter.get_distances: fix exception due to rare race
if the graph is being updated while the pathfinding is running,
channel_info might be None here
2021-03-03 14:10:57 +01:00
ThomasV 3fa1aed8cd add unit test for basic mpp 2021-03-03 12:52:52 +01:00
ThomasV ca6ecd56f2 fix route for non-trampoline MPP 2021-03-03 12:30:29 +01:00
ThomasV 1adde4c54a qt channels_list: use monospace font for channel capacity 2021-03-03 11:20:24 +01:00
ThomasV 6cf79dcfb2 qt: update all tabs when base_unit changes 2021-03-03 11:19:41 +01:00
ThomasV 222c70ada6 qt swap_dialog: use a single button to toggle direction 2021-03-03 10:45:46 +01:00
ThomasV 51f3c613a5 (minor) fix typos and indentation 2021-03-03 10:03:29 +01:00
SomberNight 44059ec116 lnpeer: more detailed logging in maybe_fulfill_htlc 2021-03-02 18:53:08 +01:00
SomberNight 9310e9023e test_lnpeer: add test: multihop payment that routes around failure
This would have caught the overpayment bug fixed in
https://github.com/spesmilo/electrum/commit/693583edc5010ece804e312626c7c40157613ff1
2021-03-02 18:35:07 +01:00
SomberNight 750d8cfab5 lnworker: run create_route_for_payment end-to-end, incl private edges
We pass the private edges to lnrouter, and let it find routes end-to-end.
Previously the edge_cost heuristics didn't apply to the private edges
and we were just randomly picking one of the route hints and use that.
So e.g. cheaper private edges were not preferred, but they are now.

PathEdge now stores both start_node and end_node; not just end_node.
2021-03-02 18:00:31 +01:00
SomberNight 4445cef033 lnutil: turn global forwarding fee params into Channel attributes
useful for unit testing, and it is the conceptually correct thing anyway
2021-03-02 14:54:47 +01:00
ThomasV 259dacd56f Trampoline MPP aggregation:
- trampoline node is the final recipient of MPP
 - each trampoline receives a bucket of HTLCs
 - if a HTLC from a bucket fails, wait for the entire bucket to fail
 - move trampoline route and onion code into trampoline module
2021-03-02 14:28:15 +01:00
ThomasV 2da90add8f maybe_fulfill_htlc: add failure reason to logs 2021-03-02 14:26:16 +01:00
ThomasV 693583edc5 lnworker: amount passed in HtlcLog must be without fees 2021-03-02 10:23:30 +01:00
SomberNight 06ea06f7d3 _calc_routing_hints_for_invoice: incl max 15 chans to avoid qr overflow
Prioritise channels that are likely to be able to receive the payment.
2021-03-01 21:55:41 +01:00