Commit graph

271 commits

Author SHA1 Message Date
ThomasV
bb21e01823 (minor) call lnwatcher.add_channel from lnworker.add_channel 2020-02-14 14:15:15 +01:00
ThomasV
471fdd1d97 follow-up previous commit 2020-02-14 13:37:45 +01:00
ThomasV
2a7b5081c9 channel states: make sure that closing_txid is saved if channel is closed 2020-02-14 13:25:04 +01:00
SomberNight
0a5ad9fda4
ecc: small API clean-up 2020-02-11 16:42:02 +01:00
ThomasV
e1ce3aace7 Separate db from storage
- storage is content-agnostic
 - db and storage are passed to wallet contructor
2020-02-10 17:45:23 +01:00
ThomasV
dbceed2647 Restructure wallet storage:
- Perform json deserializations in wallet_db
 - use StoredDict class that keeps tracks of its modifications
2020-02-04 13:35:58 +01:00
ThomasV
b08947a506 storage upgrade: convert lists to dict (txi, txo, revocation_store channels) 2020-02-04 12:11:18 +01:00
SomberNight
34612c671e
fix incorrect type hint 2020-01-21 15:39:34 +01:00
SomberNight
94888739d3
try to fix "--offline" mode 2020-01-09 19:23:24 +01:00
SomberNight
37747d7469
split network main_taskgroup: create daemon.taskgroup
network.main_taskgroup restarts every time the proxy settings are changed,
many long-running tasks (some introduced with lightning) are not prepared for and do not want this.
2020-01-09 19:23:21 +01:00
ThomasV
2c6a1f55fb
Merge pull request #5825 from SomberNight/201912_local_tx_can_be_partial
wallet: allow saving partial tx as local (if it has a txid)
2019-12-15 16:40:46 +01:00
ThomasV
34d652b0f6 follow-up previous commit 2019-12-13 11:09:18 +01:00
ThomasV
11f1541cdd lnworker: save timestamp regardless of channel state 2019-12-13 11:08:25 +01:00
SomberNight
308517d473
python 3.8: adapt to breaking changes re asyncio.CancelledError
(and TimeoutError)

closes #5798
2019-12-11 23:07:47 +01:00
SomberNight
daef1a8359
lnworker: don't log InvoiceError
lnworker._pay does not need log_exceptions decorator,
as we properly await the coroutine
2019-12-10 03:19:56 +01:00
SomberNight
b99add59c3
lnworker: introduce PaymentAttemptLog NamedTuple 2019-12-10 03:17:57 +01:00
SomberNight
5c9bd2d2b4
ln channel open: save funding tx as local tx into wallet 2019-12-08 04:33:36 +01:00
SomberNight
adaa016e78
LNPeerAddr: fix equality tests and hence lnworker._last_tried_peer
follow-up 13d6997355
2019-11-29 00:53:18 +01:00
SomberNight
13d6997355
LNPeerAddr: validate arguments
no longer subclassing NamedTuple (as it is difficult to do validation then...)
2019-11-26 00:15:33 +01:00
SomberNight
ddeb176b3d
kivy: fix open_channel (API was changed) 2019-11-23 20:50:30 +01:00
SomberNight
557987d4eb
add/fix some open_channel related type hints 2019-11-23 20:28:46 +01:00
ThomasV
fd8236538a Open lightning channels with partially signed tx.
Fixes #5379.
2019-11-23 19:49:12 +01:00
SomberNight
268e245322
lnpeer: only set initialized after both sent AND received "init"
had a trace where we tried to send "funding_locked" before being initialized:

D | lnpeer.Peer.[iq7zhmhck54vcax2vlrdcavq2m32wao7ekh6jyeglmnuuvv3js57r4id.onion:9735] | Sending FUNDING_LOCKED
E | lnworker.LNWallet | Exception in on_update_open_channel: AttributeError("'LNTransport' object has no attribute 'sk'")
Traceback (most recent call last):
  File "...\electrum\electrum\util.py", line 999, in wrapper
    return await func(*args, **kwargs)
  File "...\electrum\electrum\lnworker.py", line 674, in on_update_open_channel
    peer.send_funding_locked(chan)
  File "...\electrum\electrum\lnpeer.py", line 876, in send_funding_locked
    self.send_message("funding_locked", channel_id=channel_id, next_per_commitment_point=per_commitment_point_second)
  File "...\electrum\electrum\lnpeer.py", line 102, in send_message
    self.transport.send_bytes(raw_msg)
  File "...\electrum\electrum\lntransport.py", line 93, in send_bytes
    lc = aead_encrypt(self.sk, self.sn(), b'', l)
AttributeError: 'LNTransport' object has no attribute 'sk'
2019-11-22 21:33:56 +01:00
ThomasV
61dfcba092 Refactor channel states:
- persisted states are saved
 - state transitions are checked
 - transient states are stored in channel.peer_state
 - new channel states: 'PREOPENING', 'FUNDED' and 'REDEEMED'
 - upgrade storage to version 21
2019-11-22 20:14:54 +01:00
ThomasV
8e08ca7cb1 simplify network callbacks in lnworker 2019-11-22 15:06:37 +01:00
ThomasV
b469df5283 check channel funding_tx amount and script in save_short_channel_id 2019-11-21 20:16:04 +01:00
SomberNight
ae04434206
ln: update list of fallback nodes
with some popular nodes from 1ml.com
2019-11-20 17:14:14 +01:00
ThomasV
aa37979100 fix #5761 2019-11-18 10:22:20 +01:00
ThomasV
78813dcb7d Pass make_tx function to ConfirmTxDialog
- allow 'spend max' when opening a channel (fixes #5698)
 - display amount minus fee when 'max' buttons are pressed
 - estimate fee of channel funding using a template with dummy address
2019-11-14 10:20:19 +01:00
SomberNight
bafe8a2fff
integrate PSBT support natively. WIP 2019-11-04 22:24:36 +01:00
SomberNight
75902f8e35
fix logic error in lnworker.on_channel_closed 2019-10-29 20:39:58 +01:00
ThomasV
a4944cdcb2 delete channel from db in remove_channel, becaose it is called from lnworker 2019-10-23 08:20:15 +02:00
ThomasV
2234f93d8b fix fee in lnworker.get_history (sign error) 2019-10-22 18:27:41 +02:00
ThomasV
aac0fe9ae6 kivy: show status with color. show inflight attempts. 2019-10-22 15:41:45 +02:00
SomberNight
106bc6d2b2
follow-up prev 2019-10-15 15:41:18 +02:00
fiatjaf
38622c0a99 fix expected returned peer address values when opening channel. 2019-10-15 01:05:37 -03:00
ThomasV
db833e1ba3 lnworker: less verbose 2019-10-14 10:42:41 +02:00
ThomasV
c9d403cb7b minor: callback unknown_channels (follow-up 0966edc637) 2019-10-14 10:39:52 +02:00
ThomasV
90ce9f195b Allow user to enable lightning in the GUI. Make it a per-wallet setting. 2019-10-13 20:34:38 +02:00
ThomasV
0966edc637 fine-grained callbacks for lightning network dialog 2019-10-12 19:15:51 +02:00
ThomasV
fe550c6c73 payment log: show whether channel have been blacklisted 2019-10-12 18:36:25 +02:00
ThomasV
3897cf725d move handle_error_code_from_failed_htlc to lnworker because it requires access to the network object 2019-10-12 18:22:19 +02:00
ThomasV
8f86a15f92 improve payment log dialog 2019-10-12 13:47:10 +02:00
ThomasV
5377eb907c follow-up dd0be1541e 2019-10-12 12:59:38 +02:00
ThomasV
dd0be1541e Improve handling of lightning payment status:
- Move 'handle_error_code_from_failed_htlc' to channel_db,
and call it from pay_to_route, because it should not be
called when HTLCs are forwarded.
- Replace 'payment_received' and 'payment_status'
callbacks with 'invoice_status' and 'request_status'.
- Show payment error logs in the Qt GUI
- In the invoices list, show paid invoices for which
we still have the log.
2019-10-11 17:51:33 +02:00
ThomasV
d6d644190e lnworker: return error reason in await_payment 2019-10-11 13:37:54 +02:00
ThomasV
0557738a6b follow-up previous commit 2019-10-11 12:54:00 +02:00
ThomasV
c4ab1e6fad Encapsulate lightning payment events:
- make LNWorker.pending_payments private
 - public methods: payment_sent, payment_received, await_payment
2019-10-11 10:18:28 +02:00
ThomasV
638de63f13 lnworker: rename 'invoices' to 'payments' when they can be in both directions 2019-10-09 20:16:11 +02:00
ThomasV
bcb10e6e53 remove redundant test from lnworker._pay, rename pay_to_route parameter to lnaddr 2019-10-04 18:06:53 +02:00