Commit graph

298 commits

Author SHA1 Message Date
ThomasV
8ff1921c0d (minor) fix log 2020-02-24 13:23:11 +01:00
ThomasV
5785c2fa2f Fix #5975: Forget or redeem channels that are never funded.
- initiator: wait until double spent
 - non-initiator: wait until timeout
2020-02-24 12:45:10 +01:00
ThomasV
20d8da7e24 db upgrade: store channel tx height and timestamps in 'channels' 2020-02-24 10:07:55 +01:00
ThomasV
e8ee4250d9 Do not save new channels before they are added to lnworker 2020-02-24 09:44:35 +01:00
ThomasV
947211fe4e follow-up 54ef6db762: set channel state to OPENING if funding tx was broadcast later (e.g. cold storage) 2020-02-23 20:43:23 +01:00
SomberNight
cc5624fb20
don't raise BaseException 2020-02-23 19:55:09 +01:00
ThomasV
54ef6db762 do not try to reestablish channels in PREOPENING state (per BOLT2). 2020-02-23 14:54:04 +01:00
ThomasV
64a8de8bae Qt: show amounts sent to channels in show_transaction 2020-02-22 16:02:02 +01:00
ThomasV
fa62d03c2a require option static_remotekey in lnwallet 2020-02-22 09:04:42 +01:00
ThomasV
bda23ef73d Use a Future for lnpeer.initialized, so that exceptions are passed to the GUI 2020-02-22 09:04:24 +01:00
ThomasV
1b586faec9 disable peer filtering in lnworker 2020-02-21 17:41:20 +01:00
ThomasV
55e0e1a72e Generate channel keys from random seed 2020-02-21 12:38:12 +01:00
ThomasV
86d1e50469 select peers with desired features before connecting 2020-02-21 10:57:13 +01:00
ThomasV
2255b07157 support option_static_remotekey 2020-02-20 21:02:01 +01:00
ThomasV
47d14c579b minor fix: can_send, can_receive 2020-02-20 21:01:42 +01:00
ThomasV
704c3ae07f do not allow channel creation from backup file 2020-02-20 19:09:05 +01:00
ThomasV
9451ca9568 move list_channels to commands.py 2020-02-20 10:30:30 +01:00
ThomasV
238fb46d87 Lightning: Show sending and receiving capacity. Fixes #5967 2020-02-19 16:11:55 +01:00
ThomasV
feb47b0a6f Add lightning tx dialog (qt and kivy) 2020-02-18 13:02:18 +01:00
SomberNight
46d8080c76
ln gossip: don't put own channels into db; always pass them to fn calls
Previously we would put fake chan announcement and fake outgoing chan upd
for own channels into db (to make path finding work). See Peer.add_own_channel().
Now, instead of above, we pass a "my_channels" param to the relevant ChannelDB methods.
2020-02-17 20:38:41 +01:00
ThomasV
4dc74870e1 Catch exceptions raised in LNWorker._pay_to_route
Reset payment status if an exception is caught.
Also, do not pass status to the 'invoice_status' network callback.
This fixes #5869, #5870, #5964.
2020-02-17 12:33:43 +01:00
ThomasV
472c0defee fix lnchannel.get_payments: unsettled htlcs may have overwritten the returned results. 2020-02-17 12:19:18 +01:00
ThomasV
938fab86d1 detect redeemed channels (fix #5963) 2020-02-16 19:07:20 +01:00
ThomasV
f8da0f87a7 follow-up previous commit 2020-02-16 14:45:04 +01:00
ThomasV
3a35f90aa0 Do not use network callback to update channel states; call LNWorker methods directly instead.
A callback was used because a single LNWnwatcher object used to be shared for all wallets.
Since wallet now have their own LNWatcher instance, this can be simplified.
2020-02-16 14:26:18 +01:00
ThomasV
36f32651cc Define network.try_broadcasting() method.
Use it when rebroadcasting a force-close tx,
because the channel state is already set.
2020-02-16 12:59:09 +01:00
ThomasV
2dad87cbb4 Automate backups:
- backup wallet file on each channel creation
 - on android, a backup password is entered in settings
 - on desktop, the backup path is in settings
2020-02-15 16:28:15 +01:00
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