Commit graph

220 commits

Author SHA1 Message Date
ThomasV
d9b041e64d encapsulate detect_who_closed in channel 2019-08-20 09:03:11 +02:00
ThomasV
24cc3599c7 lnworker: catch exceptions raised by add_future_tx 2019-08-20 09:03:11 +02:00
ThomasV
740ef09883 simplify_lnsweep 2019-08-20 09:03:11 +02:00
ThomasV
50479086b5 raise PaymentFailure in case of timeout (follow-up previous commit) 2019-08-20 09:03:11 +02:00
ThomasV
dbe8b75659 move lnpay attempts logic to lnworker.pay 2019-08-20 09:03:11 +02:00
ThomasV
81d340b19c lnworker: do not create sweep transactions before outputs can be redeemed 2019-08-20 09:03:11 +02:00
ThomasV
3dacc525e6 on_network_update: check if channel is closed 2019-08-20 09:03:11 +02:00
ThomasV
6bbdbf7596 rework on_channel_closed in LNWorker:
- use detect_who_closed; this allows us to redeem to_remote of breach ctx
 - do not redeem to_local of breach ctx, because it is redundant with lnwatcher
 - rename a few methods
2019-08-20 09:03:11 +02:00
SomberNight
930d21c31c channel close handling: detect situation based on output addresses
WIP...
2019-08-20 09:03:11 +02:00
SomberNight
6d8c605307 move lnworker.first_block to constants 2019-08-20 09:03:11 +02:00
ThomasV
a70441f0f1 minor fixes: remove_channel 2019-08-20 09:03:11 +02:00
ThomasV
6d9ef29690 redo LNWorker pay:
- wait until htlc has been fulfilled
 - raise if htlc is not fulfilled
 - return boolean success
 - try multiple paths in GUI
2019-08-20 09:03:11 +02:00
ThomasV
fed6c96693 add option to remove channel after it has been closed 2019-08-20 09:03:11 +02:00
ThomasV
3c0df28c98 do not include 'force_closing' in channel states, because it is not part of the peer protocol 2019-08-20 09:03:11 +02:00
ThomasV
d30307b29e gui: improve display of lightning status 2019-08-20 09:03:11 +02:00
ThomasV
b055eeace2 prune channels older than two weeks from database 2019-08-20 09:03:11 +02:00
ThomasV
522ce5bb9f verify channel updates in peer's TaskGroup 2019-08-20 09:03:11 +02:00
ThomasV
308dc6aa6b use a single queue for gossip messages, so that they are processed in the correct order 2019-08-20 09:03:11 +02:00
ThomasV
0e42fd9f17 parallelize short_channel_id requests 2019-08-20 09:03:11 +02:00
ThomasV
1011245c5e LNGossip: sync channel db using query_channel_range 2019-08-20 09:03:11 +02:00
ThomasV
95376226e8 save lightning invoice descriptions as labels and allow user to edit them 2019-08-20 09:03:11 +02:00
ThomasV
e53ecb9b77 add labels to lightning history 2019-08-20 09:03:11 +02:00
ThomasV
c4081284bd lightning: GUI improvements 2019-08-20 09:03:11 +02:00
ThomasV
9a3a63d18e logging (follow-up rebase) 2019-08-20 09:03:11 +02:00
SomberNight
cc57da704b logging: adapt lightning branch to logging changes 2019-08-20 09:03:11 +02:00
ThomasV
730be17aba Use separate lightning nodes for gossip and channel operations. 2019-08-20 09:03:11 +02:00
ThomasV
34f22e6681 lnrouter: load data before finding path 2019-08-20 09:03:11 +02:00
ThomasV
f0ac81419c increase timeout in open_channel 2019-08-20 09:03:11 +02:00
ThomasV
aa398993cf lnrouter fixes:
- use gossip_queries_req instead of initial_routing_sync
 - add connected nodes to recent peers only after successful init
 - derive timestamp used with gossip_timestamp_filter from channel_db
 - fix query_short_channel_ids:
     1. channel IDs must be sorted with zlib
     2. limit request to 100
     3. do not abuse this to request node_announcements; it is fine not to have all nodes.
 - fix get_recent_peers:
     1. do not set last_connected_date to 'now' if we never connected a node
     2. sql query was misconstructed and was returning only one peer
 - populate FALLBACK_NODE_LIST_MAINNET with nodes that have the requested flags
2019-08-20 09:03:11 +02:00
ThomasV
3abe30e9d8 basic watchtower synchronization 2019-08-20 09:03:11 +02:00
ThomasV
ec97d623a5 force-close channel if unfulfilled htlc is close to cltv expiry 2019-08-20 09:03:11 +02:00
ThomasV
8d77a7ecd8 save timestamps in htlc log 2019-08-20 09:03:11 +02:00
ThomasV
51466930f2 reestablish_peers_and_channels: spawn tasks in for loop 2019-08-20 09:03:11 +02:00
ThomasV
38f1436d78 post rebase fixes 2019-08-20 09:03:11 +02:00
ThomasV
436c313790 follow-up previous commit 2019-08-20 09:03:11 +02:00
ThomasV
9f188c087c Flatten the structure of lnrouter, so that DBSession is not used outside of ChannelDB 2019-08-20 09:03:11 +02:00
Janus
dd7c4b3bab sqlite in lnrouter 2019-08-20 09:03:11 +02:00
ThomasV
7a51f034e4 add future transactions to address synchronizer 2019-08-20 09:03:11 +02:00
ThomasV
7a0e8bb343 fix amount_msat sign in get_history 2019-08-20 09:03:11 +02:00
ThomasV
8b12f481da lightning: display forwarded payments as a single history item 2019-08-20 09:03:11 +02:00
ThomasV
3e443535a2 lnchannel: pass reference to lnworker 2019-08-20 09:03:11 +02:00
SomberNight
ef7a59b4a9 lnchannel: save htlc preimages as soon as possible but horribly hacky
will properly clean this up...
2019-08-20 09:03:11 +02:00
SomberNight
7292da24e6 lnchannel: only consider payments finished when we revoke our old ctx
in the old code,
`self.hm.received_in_ctn(self.config[REMOTE].ctn + 1)`
did not really make sense as "received_in_ctn" compares the argument against the LOCAL ctn
2019-08-20 09:03:11 +02:00
SomberNight
962628ac3d lnworker: minor clean-up re payment_completed 2019-08-20 09:03:11 +02:00
ThomasV
62be0c481c lightning: Save invoices and preimages separately. Save preimages when forwarding 2019-08-20 09:03:11 +02:00
ThomasV
3dce65dc73 Rename lnchan, lnchannel_verifier, lnbase
Auto-completions are a pain if files share a long prefix
2019-08-20 09:03:11 +02:00
Janus
8274a963e6 lnworker: save outgoing invoice when initiating payment 2019-08-20 09:03:11 +02:00
ThomasV
a975ac1571 lnworker: get_channel_by_short_id 2019-08-20 09:03:11 +02:00
ThomasV
f4b2644620 set short_channel_id regardless of channel state, because peer might be disconnected 2019-08-20 09:03:11 +02:00
ThomasV
d9813540ac fix: test short_channel_id before removing from channel_db 2019-08-20 09:03:11 +02:00