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
ThomasV
cfc20845a2
lnworker: dissociate htlc forwarding and fulfillment
2020-03-02 11:54:08 +01:00
ThomasV
09675bd911
make maybe_fulfill_htlc, maybe_forward_htlc synchronous.
...
move async operations to lnworker.htlc_switch
2020-03-02 11:19:04 +01:00
ThomasV
d827aedd16
lnpeer: do not drop channel updates if cannot send
2020-03-02 11:19:04 +01:00
ThomasV
da67fda92a
HTLC switch:
...
- fulfills/fails/forwards HTLCs
- onion_packets are saved when update_add_htlc is received
2020-03-02 11:19:04 +01:00
SomberNight
6f2cd8b4f5
Qt tx dialog: allow setting custom locktime
...
closes #2405
closes #1685
2020-03-01 09:14:50 +01:00
SomberNight
0147623d11
lnpeer: Peer.is_initialized() should not raise
...
Traceback (most recent call last):
File "...\electrum\electrum\gui\qt\main_window.py", line 434, in on_network_qt
self.update_lightning_icon()
File "...\electrum\electrum\gui\qt\main_window.py", line 2092, in update_lightning_icon
cur, total = self.network.lngossip.get_sync_progress_estimate()
File "...\electrum\electrum\lnworker.py", line 373, in get_sync_progress_estimate
if self.num_peers() == 0:
File "...\electrum\electrum\lnworker.py", line 202, in num_peers
return sum([p.is_initialized() for p in self.peers.values()])
File "...\electrum\electrum\lnworker.py", line 202, in
return sum([p.is_initialized() for p in self.peers.values()])
File "...\electrum\electrum\lnpeer.py", line 128, in is_initialized
return self.initialized.done() and self.initialized.result() is True
concurrent.futures._base.CancelledError
2020-02-29 20:10:02 +01:00
SomberNight
67d24bf129
add LN gossip sync progress estimate indicator to Qt GUI
2020-02-29 20:03:35 +01:00
SomberNight
a32af44ff9
trivial clean-up (typing/imports)
2020-02-28 20:27:35 +01:00
ThomasV
077f778632
Replace lightning_settle_delay with enable_htlc_settle (asyncio.Event)
2020-02-28 10:15:28 +01:00
ThomasV
15e91169c5
lnpeer: fix json serialization of funding_inputs
2020-02-27 19:51:16 +01:00
ThomasV
8f6fc5917a
make sure we can send shutdown
2020-02-27 19:19:10 +01:00
SomberNight
ed234d3444
rename all TaskGroup() fields to "taskgroup"
...
for consistency
2020-02-27 19:13:56 +01:00
SomberNight
c8260249b0
lnworker: add own taskgroup (run in daemon.taskgroup)
2020-02-27 19:13:53 +01:00
ThomasV
0bf09d14a0
fix regression in shutdown (from 1c5dc79298
)
2020-02-27 19:01:06 +01:00
ThomasV
34400c0710
Set channel state to OPENING as soon as we receive 'funding_signed',
...
instead of when the funding transaction has been broadcast, because
we have no reliable way to know when it will be broadcast.
2020-02-27 18:12:20 +01:00
ThomasV
d04b8c05e2
(minor) fix typo in comment
2020-02-27 14:48:08 +01:00
ThomasV
f5053cc242
follow-up e54c69b861
: we must settle HTCLs after during shutdown
2020-02-27 14:40:58 +01:00
SomberNight
6161853941
lnpeer: reduce log spam due to incompatible feature bits
2020-02-26 21:10:33 +01:00
SomberNight
e54c69b861
add lnchannel.can_send_ctx_updates. just drop illegal updates for now
2020-02-26 20:35:46 +01:00
ThomasV
3d0c1dbd5c
restore log lines for send_commitment, on_commitment_signed
2020-02-26 19:14:49 +01:00
ThomasV
87fe2c7d7a
define channel.has_pending_changes method
2020-02-26 19:08:48 +01:00
ThomasV
1c5dc79298
shutdown:
...
- resend shutdown on reestablish
- wait until no more pending updates before sending shutdown
2020-02-26 16:06:28 +01:00
ThomasV
9b97469598
(minor) follow-up previous commit
2020-02-26 15:49:55 +01:00
ThomasV
6833adf8b6
simplify previous commit (revert changes on transaction.py)
2020-02-26 14:16:21 +01:00
ThomasV
e85fb25146
lnpeer: verify signature in closing_signed
2020-02-26 12:58:40 +01:00
ThomasV
0848aa259d
(minor) simplification
2020-02-26 11:30:19 +01:00
ThomasV
d5c03307c3
the funder sends the first 'closing_signed' message
2020-02-26 11:15:03 +01:00
SomberNight
e9251c8e59
lnpeer: add "DO NOT TRUST..." remark to errors sent by remote
...
potential phishing...
2020-02-25 20:09:33 +01:00
SomberNight
aaf174ef3e
lnpeer: cooperative close: verify scriptpubkey matches templates
2020-02-25 17:54:49 +01:00
ThomasV
2927478192
lnpeer: closing fee negociation:
...
- use fee_rate from config
- set upper bound on fee
- add test_close to test_lnpeer
2020-02-25 15:23:15 +01:00