Commit Graph

276 Commits

Author SHA1 Message Date
ThomasV
1323bd4f9c open_channel_coroutine: do not timeout on sign_transaction. fixes #7027 2021-02-15 16:47:42 +01:00
ThomasV
87a080d30e split code in htlc_switch:
- raise OnionRoutingFailure whenever we want to fail a htlc
 - catch that exception in htlc_switch
 - this will avoid code duplication in the case of trampoline
2021-02-11 06:19:17 +01:00
bitromortac
2bffc9d3eb lnpeer: fix timed out mpp 2021-02-05 21:52:13 +01:00
ThomasV
ef5a265449 basic_mpp: receive multi-part payments 2021-02-04 16:31:17 +01:00
ThomasV
e477a43385 PaymentInfo: use msat precision 2021-02-01 15:03:56 +01:00
SomberNight
2b0f156ce8 lnpeer.htlc_switch: (bugfix) don't fulfill htlc until add is irrevocable
This makes the test added in prev commit pass.
2021-01-28 20:03:30 +01:00
SomberNight
e8a2fa5596 tests: lnpeer.htlc_switch: don't fulfill htlc until add is irrevocable
This adds a failing test, where the HTLC switch fulfills an HTLC too soon,
before the corresponding 'update_add_htlc' is irrevocably committed.
2021-01-28 20:00:48 +01:00
ThomasV
521376f87f rm unused parameter in maybe_fulfill_htlc 2021-01-28 13:10:43 +01:00
ThomasV
fe1b2149cb lnpeer: fix flen in INIT 2021-01-28 11:14:53 +01:00
ThomasV
23ece8b33b lnpeer: initialize new channel storage with lnworker db 2021-01-16 19:04:58 +01:00
bitromortac
bd178fbed5 lnpeer: remove unused imports, code cleanup 2021-01-11 11:37:14 +01:00
bitromortac
6b90a2d36c lnpeer: implement upfront shutdown script logic
Upfront shutdown script is a script provided on channel opening,
which will be used by the peer to enforce us closing to this script
on collaborative channel close.
2021-01-11 11:37:14 +01:00
bitromortac
863fe031f0 lnpeer: await on_message handlers to raise exceptions 2021-01-11 11:36:38 +01:00
ThomasV
177766ac37 lnpeer: fix a comment 2021-01-04 12:39:24 +01:00
ThomasV
eb6eac9254 fix reserve_sat in local_config. see #6896 2020-12-31 08:44:26 +01:00
ThomasV
b29cdc02da Require gossip_queries in LNWallet (follow-up f83d2d9fee)
- workaround lnd bug https://github.com/lightningnetwork/lnd/issues/3651
 - also reduces bandwidth usage
2020-12-28 15:41:42 +01:00
ThomasV
f83d2d9fee Move the part of process_gossip that requires access to channel_db into in LNGossip. 2020-12-21 13:33:34 +01:00
ThomasV
dfcdcb8d64 fix typo 2020-11-20 08:51:01 +01:00
SomberNight
82c8c4280f lnworker: add request_remote_force_close which can be used without state
see #6656
2020-10-17 03:59:50 +02:00
SomberNight
35f1f2905b lnpeer: forbid creating Peer with ourselves (self-connect)
related: #6583
2020-09-15 18:35:16 +02:00
SomberNight
ea3e3ddbb8 lnpeer: handle cooperative close edge-case
fix #6317
2020-09-13 16:55:37 +02:00
SomberNight
aba2e0f55a lnhtlc: add all_htlcs_ever, get_htlc_by_id, was_htlc_failed and use them
towards encapsulation of hm.log
2020-09-04 19:29:14 +02:00
ThomasV
0b16f8ec3a lnpeer: only process INIT if we are a backup. fixes #6241 2020-06-23 13:12:11 +02:00
SomberNight
1321b0e47a qt channel details: maybe fix #5728 2020-06-21 05:16:27 +02:00
ThomasV
aacddf008c trigger_force_close: set my_current_per_commitment_point to a valid point
We could as well derive the point from our channel_seed and ctn=0,
but that seems unnecessary. Related: #6241
2020-06-19 12:04:04 +02:00
SomberNight
5401b3f72d channel backups: try fixing force-close-trigger 2020-06-19 06:38:00 +02:00
SomberNight
4c70956687 filter callbacks to wallet: channel, payment_succeeded, payment_failed
It is ugly that the 'channel' callback takes a wallet I guess,
but with channel backups in one wallet, and active channels in another,
it was causing problems... (when open simultaneously)
2020-06-19 04:11:35 +02:00
SomberNight
3509343447 ln: make 'to_self_delay' CSV configurable
needed for tests
2020-06-09 18:36:34 +02:00
SomberNight
fc39295d20 lnpeer: review safety check re channel open flow, and tweak params 2020-06-08 21:17:23 +02:00
ThomasV
2571669a32 fix #6200: if we cannot parse an onion, send a failure code that has the BADONION bit 2020-06-05 12:31:04 +02:00
ThomasV
47b3c49b25 split lnpeer.fail_htlc into two methods with less parameters 2020-06-05 12:01:31 +02:00
ThomasV
2adbbee5fe Add extra state to distinguish shutdown negotiation from post-
negotiation, where channel should not be reestablished. See #6182
2020-05-29 18:00:52 +02:00
ThomasV
6aa337c618 fix #6176 2020-05-27 18:13:30 +02:00
SomberNight
530a446172 follow-up prev: don't reuse funding tx change address for static_remotekey
see comment in code
2020-05-22 17:19:55 +02:00
SomberNight
6040e953a3 wallet: implement reserving addresses, and use it for LN SRK to_remote
- Use change addresses (instead of receive) for the static_remotekey to_remote outputs,
  and reserve these to greatly reduce the chance of address-reuse
- Use change addresses (instead of receive) for LN channel sweep addresses.
  Note that these atm are not getting reserved.
2020-05-22 17:19:51 +02:00
SomberNight
f9de6a5354 tests: lnpeer: make debug htlc failure hooks more uniform 2020-05-14 19:15:32 +02:00
SomberNight
2b0ed9f406 (trivial) lnpeer: rm @log_exceptions from htlc_switch 2020-05-14 19:15:29 +02:00
SomberNight
cc4029c335 test_lnpeer: add some multi-hop payment unit tests 2020-05-06 11:06:44 +02:00
SomberNight
7153e753d1 lnworker._pay: allow specifying path as argument
not exposed to CLI/etc yet but will be used in tests soon
2020-05-06 11:06:40 +02:00
ThomasV
887b643706 follow-up prev commit... 2020-05-05 09:58:50 +02:00
ThomasV
a8c14e65ad follow-up prev commit 2020-05-05 09:57:01 +02:00
ThomasV
1529b07aa4 follow-up prev commit 2020-05-05 09:55:56 +02:00
ThomasV
c1b1638615 fix htlc forwarding:
- persist fail_htlc error messages
 - do not rely on payment_hash in htlc_switch
2020-05-05 09:23:48 +02:00
ThomasV
ab188ff375 add config variable to test update_fail_malformed_htlc 2020-05-04 20:31:44 +02:00
ThomasV
abe1bece2c remove UnknownPaymentHash (exception used as value) 2020-05-02 22:37:28 +02:00
SomberNight
8389892dbd lnpeer: (trivial) log name for chan.state and chan.peer_state
IntEnum.__format__ just returns an int:

>>> from enum import IntEnum
>>> class Colours(IntEnum):
...   red = 1
...   blue = 2
...
>>> var = Colours.red
>>> f"{var}"
'1'
>>> f"{var!s}"
'Colours.red'
>>> f"{var!r}"
'<Colours.red: 1>'
2020-05-01 03:43:12 +02:00
SomberNight
6f7a4ab048 lnpeer: add get_channel_by_id, for small speed-up 2020-04-30 21:13:29 +02:00
SomberNight
b9b53e7f76 lnworker: fix threading issues for .channels attribute
external code (commands/gui) did not always take lock when iterating lnworker.channels.
instead of exposing lock, let's take a copy internally (as with .peers)
2020-04-30 21:08:26 +02:00
ThomasV
ef5ad5f22f extend 'add_peer', 'list_peers' commands to gossip 2020-04-16 12:39:12 +02:00
SomberNight
223b62554e lntransport: use network proxy if available
fixes #4824
2020-04-15 21:44:09 +02:00