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
SomberNight
90cb032721
lnworker: implement exponential backoff for retries
2020-04-15 17:24:04 +02:00
ThomasV
9224404108
Move callback manager out of Network class
2020-04-14 18:29:51 +02:00
SomberNight
54e1520ee4
ln: check if chain tip is stale when receiving HTLC
...
if so, don't release preimage / don't forward HTLC
2020-04-13 17:04:27 +02:00
SomberNight
12283d625b
(trivial) rename lnchannel.channel_states to ChannelState
2020-04-13 16:02:05 +02:00
ThomasV
821431a239
lnpeer: move ping_if_required away from message_loop
...
If our connection dies because we went to sleep, message_loop
will stall and ping_if_required will never be called.
2020-04-13 11:34:58 +02:00
ThomasV
99f933401a
add more logging shortcuts
2020-04-12 12:30:59 +02:00
ThomasV
74517c88ad
do not use short_channel_id as state, use channel state for that.
...
display it as soon as the funding tx is mined.
2020-04-10 15:10:50 +02:00
ThomasV
8f41aeb783
Replace wallet backup with channel backups
...
- channels can be backed up individually
- backups are added to lnwatcher
- AbstractChannel ancestor class
2020-04-10 14:45:23 +02:00
ThomasV
d2a58a2ec3
lnpeer: do not assume our privkey is the same as lnworker's privkey.
2020-04-06 19:06:27 +02:00
ThomasV
f3995350e8
localconfig: rename seed to channel_seed
2020-04-06 16:53:48 +02:00
ThomasV
0ea21c59d2
Save channel seed in localconfig
2020-04-04 13:28:19 +02:00
SomberNight
1be0a710c3
ln: implement option payment_secret
2020-04-01 21:49:12 +02:00
SomberNight
d424487814
lnpeer: better error handling when processing onion packets
2020-04-01 21:47:45 +02:00
SomberNight
30bf32b34b
use option varonion: actually use TLV payloads, and signal support
2020-04-01 21:47:42 +02:00
SomberNight
a66437f399
lnonion: implement basis of varonion support
2020-04-01 21:42:48 +02:00
SomberNight
6ba08cc8d4
ln feature bits: flatten namespaces, and impl feature deps and ctxs
...
This implements:
- flat feature bits https://github.com/lightningnetwork/lightning-rfc/pull/666
- feature bit dependencies https://github.com/lightningnetwork/lightning-rfc/pull/719
2020-04-01 21:41:24 +02:00
SomberNight
71a4302ec0
lnpeer: send and handle "networks" param in "init" msg
2020-04-01 21:40:09 +02:00
SomberNight
3a73f6ee5c
lnmsg.decode_msg: dict values for numbers are int, instead of BE bytes
...
Will be useful for TLVs where it makes sense to do the conversion in lnmsg,
as it might be more complicated than just int.from_bytes().
2020-04-01 21:39:52 +02:00
SomberNight
4c10a830f3
lnmsg: rewrite LN msg encoding/decoding
2020-04-01 21:39:48 +02:00
SomberNight
db84de5493
trivial: use "chunks()" for htlc_sigs in lnchannel
2020-03-30 02:46:25 +02:00
SomberNight
90f3b667aa
small clean-up re max CLTV delta for LN
2020-03-30 02:46:14 +02:00
SomberNight
01207316aa
storage upgrade: move "htlc_minimum_msat" to base channel config
2020-03-26 09:05:04 +01:00
SomberNight
cf5872d2c1
follow-up prev
2020-03-17 21:19:26 +01:00
SomberNight
2cc76fbbbd
lnworker: fix type error re pending_payments, and impl malformed htlcs
...
In old code, in lnpeer.htlc_switch(), "error" in lnworker.pending_payments
had incorrect type.
TODO: we need tests for payment failures...
2020-03-17 20:32:38 +01:00
SomberNight
b524460fdf
lnpeer: implement basic handling of "update_fail_malformed_htlc"
2020-03-17 20:31:50 +01:00
ThomasV
ffa3760a17
follow-up prev: rm decorator, preprocess channel_id for all messages
2020-03-11 17:02:44 +01:00
ThomasV
386d385389
lnpeer: channel_update decorator
2020-03-11 14:17:06 +01:00
ThomasV
2c617c3b00
move feerate warning to lnpeer
2020-03-06 18:14:00 +01:00
ThomasV
888a6d726e
Propagate exceptions raise by force_close to the GUI.
...
Define 'try_force_closing' for cases where we do not
want exceptions to be raised.
2020-03-06 12:18:33 +01:00
ThomasV
28452e2d46
do not try to reestablish channel if state is FORCE_CLOSING
2020-03-06 11:25:34 +01:00
SomberNight
fa0ef9c548
ln: store network addresses for channel counterparties in channels
...
So we can reconnect to them without relying on gossip db.
2020-03-06 04:04:17 +01:00
ThomasV
8f3fcdd1a8
Fix detection of payments.
...
1. In lnhtlc, sent_in_ctn and failed_in_ctn need to look at the
remote ctx, and they need to be called when we receive a revocation,
not when we send one.
2. In lnchannel, we use 3 lnworker callbacks:
- payment sent/payment failed (called when we receive a revocation)
- payment received (called when we send a revocation)
3. Make revoke_current_commitment return a single value.
The second value was only used in tests, there is no need
to bloat the code with that
2020-03-05 07:03:09 +01:00
ThomasV
b9eaba3e85
replace await_local/remote
2020-03-05 07:03:09 +01:00
ThomasV
4c177c4c92
less verbose update_fee log
2020-03-04 08:35:56 +01:00
ThomasV
79497cd3ec
(minor) rm unneeded decorator
2020-03-02 21:45:45 +01:00
ThomasV
97d191a121
maybe_forward_htlc: catch exceptions raised by nexp_peer. return only error
2020-03-02 21:18:56 +01:00
ThomasV
f801307a08
move htlc_switch task to lnpeer
2020-03-02 15:41:50 +01:00
ThomasV
5d3bca7bb8
htlc_switch: decouple maybe_send_commitment from htlc processing
2020-03-02 15:08:12 +01:00