SomberNight
cf5872d2c1
follow-up prev
5 years ago
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...
5 years ago
SomberNight
b524460fdf
lnpeer: implement basic handling of "update_fail_malformed_htlc"
5 years ago
ThomasV
ffa3760a17
follow-up prev: rm decorator, preprocess channel_id for all messages
5 years ago
ThomasV
386d385389
lnpeer: channel_update decorator
5 years ago
ThomasV
2c617c3b00
move feerate warning to lnpeer
5 years ago
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.
5 years ago
ThomasV
28452e2d46
do not try to reestablish channel if state is FORCE_CLOSING
5 years ago
SomberNight
fa0ef9c548
ln: store network addresses for channel counterparties in channels
So we can reconnect to them without relying on gossip db.
5 years ago
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
5 years ago
ThomasV
b9eaba3e85
replace await_local/remote
5 years ago
ThomasV
4c177c4c92
less verbose update_fee log
5 years ago
ThomasV
79497cd3ec
(minor) rm unneeded decorator
5 years ago
ThomasV
97d191a121
maybe_forward_htlc: catch exceptions raised by nexp_peer. return only error
5 years ago
ThomasV
f801307a08
move htlc_switch task to lnpeer
5 years ago
ThomasV
5d3bca7bb8
htlc_switch: decouple maybe_send_commitment from htlc processing
5 years ago
ThomasV
cfc20845a2
lnworker: dissociate htlc forwarding and fulfillment
5 years ago
ThomasV
09675bd911
make maybe_fulfill_htlc, maybe_forward_htlc synchronous.
move async operations to lnworker.htlc_switch
5 years ago
ThomasV
d827aedd16
lnpeer: do not drop channel updates if cannot send
5 years ago
ThomasV
da67fda92a
HTLC switch:
- fulfills/fails/forwards HTLCs
- onion_packets are saved when update_add_htlc is received
5 years ago
SomberNight
6f2cd8b4f5
Qt tx dialog: allow setting custom locktime
closes #2405
closes #1685
5 years ago
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
5 years ago
SomberNight
67d24bf129
add LN gossip sync progress estimate indicator to Qt GUI
5 years ago
SomberNight
a32af44ff9
trivial clean-up (typing/imports)
5 years ago
ThomasV
077f778632
Replace lightning_settle_delay with enable_htlc_settle (asyncio.Event)
5 years ago
ThomasV
15e91169c5
lnpeer: fix json serialization of funding_inputs
5 years ago
ThomasV
8f6fc5917a
make sure we can send shutdown
5 years ago
SomberNight
ed234d3444
rename all TaskGroup() fields to "taskgroup"
for consistency
5 years ago
SomberNight
c8260249b0
lnworker: add own taskgroup (run in daemon.taskgroup)
5 years ago
ThomasV
0bf09d14a0
fix regression in shutdown (from 1c5dc79298
)
5 years ago
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.
5 years ago
ThomasV
d04b8c05e2
(minor) fix typo in comment
5 years ago
ThomasV
f5053cc242
follow-up e54c69b861c2990adf9cf618b68c6f1c7dd3ebea: we must settle HTCLs after during shutdown
5 years ago
SomberNight
6161853941
lnpeer: reduce log spam due to incompatible feature bits
5 years ago
SomberNight
e54c69b861
add lnchannel.can_send_ctx_updates. just drop illegal updates for now
5 years ago
ThomasV
3d0c1dbd5c
restore log lines for send_commitment, on_commitment_signed
5 years ago
ThomasV
87fe2c7d7a
define channel.has_pending_changes method
5 years ago
ThomasV
1c5dc79298
shutdown:
- resend shutdown on reestablish
- wait until no more pending updates before sending shutdown
5 years ago
ThomasV
9b97469598
(minor) follow-up previous commit
5 years ago
ThomasV
6833adf8b6
simplify previous commit (revert changes on transaction.py)
5 years ago
ThomasV
e85fb25146
lnpeer: verify signature in closing_signed
5 years ago
ThomasV
0848aa259d
(minor) simplification
5 years ago
ThomasV
d5c03307c3
the funder sends the first 'closing_signed' message
5 years ago
SomberNight
e9251c8e59
lnpeer: add "DO NOT TRUST..." remark to errors sent by remote
potential phishing...
5 years ago
SomberNight
aaf174ef3e
lnpeer: cooperative close: verify scriptpubkey matches templates
5 years ago
ThomasV
2927478192
lnpeer: closing fee negociation:
- use fee_rate from config
- set upper bound on fee
- add test_close to test_lnpeer
5 years ago
SomberNight
e7ab9e4054
lnpeer: await_remote/await_local now more restrictive, and docstring
Previously it was not so clear what these methods were doing.
5 years ago
SomberNight
931d961721
lnpeer/lnwatcher: include channel id in log lines
5 years ago
ThomasV
5785c2fa2f
Fix #5975 : Forget or redeem channels that are never funded.
- initiator: wait until double spent
- non-initiator: wait until timeout
5 years ago
ThomasV
e8ee4250d9
Do not save new channels before they are added to lnworker
5 years ago