Commit graph

102 commits

Author SHA1 Message Date
ThomasV
8ba7e68064 fix #6122: extract preimage from on-chain htlc_tx 2020-05-03 16:03:27 +02:00
ThomasV
123b8c1792 (minor) rename chan.sweep_htlc 2020-05-02 11:42:47 +02:00
SomberNight
2b1a150c52
multi-wallet: properly stop lnworker/lnwatcher 2020-05-01 04:50:08 +02:00
ThomasV
bdb870af00 follow-up c454564ed6 2020-04-21 15:31:13 +02:00
ThomasV
9224404108 Move callback manager out of Network class 2020-04-14 18:29:51 +02:00
SomberNight
8e8ab775eb
lnchannel: make AbstractChannel inherit ABC
and add some type annotations, clean up method signatures
2020-04-13 15:57:53 +02:00
ThomasV
8f41aeb783 Replace wallet backup with channel backups
- channels can be backed up individually
 - backups are added to lnwatcher
 - AbstractChannel ancestor class
2020-04-10 14:45:23 +02:00
ThomasV
aa32e31a3d follow-up previous commit 2020-04-03 18:54:02 +02:00
ThomasV
06dfe1699c LNWatcher: Distinguish between blockchain-triggered channel state
transitions, and actions taken as a result.
- state transitions are performed in lnchannel.update_onchain_state()
- peer actions are in LNWorker.on_channel_update()
2020-04-03 17:34:11 +02:00
SomberNight
79d57784c1
lnchannel: add more type hints 2020-03-30 03:49:50 +02:00
SomberNight
ec6be665d5
lnwatcher: unwatch deeply mined channels
reduces log spam generated by "REDEEMED" channels...
2020-03-14 04:44:01 +01:00
ThomasV
8b63f7176e Add short channel id to tx labels 2020-03-07 10:53:38 +01:00
ThomasV
3c111471e9 Fix bug with save_funding_height, save_closing_height
(it would enter a state where only closing_height was saved)
2020-03-07 10:39:49 +01:00
SomberNight
931d961721
lnpeer/lnwatcher: include channel id in log lines 2020-02-24 16:32:18 +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
9616333b39 add_future_tx should return success 2020-02-22 17:20:05 +01:00
ThomasV
874efc125d (minor) trigger 'wallet_updated' callback when adding future tx 2020-02-22 12:59:48 +01:00
ThomasV
3329d9dd0e lnwatcher: fix keep_watching if the wallet was not force-closed 2020-02-21 16:35:27 +01:00
ThomasV
fe4ca4c466 follow-up previous commit 2020-02-18 20:06:35 +01:00
ThomasV
c9e39d3a79 remove channel from channel_timestamps if funding_tx has been dropped from mempool 2020-02-18 18:04:23 +01:00
SomberNight
d1fc4399e6
lnwatcher: use is_mine(addr) instead of (addr in get_addresses())
small performance gain
2020-02-18 17:16:46 +01:00
ThomasV
72f4e83333 fix race in check_onchain_situation 2020-02-18 17:06:54 +01:00
ThomasV
6e6e829ef7 breach remedy: get spender transaction from LNWatcher's db 2020-02-17 09:19:23 +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
dba6cb8a96 lnwatcher: use height == TX_HEIGHT_LOCAL to determine channel onchain state 2020-02-16 12:57:25 +01:00
ThomasV
149cd9598a Separate JsonDB and WalletDB 2020-02-03 12:36:07 +01:00
ThomasV
cded582fe9 Start watchtower if run_watchtower is set, even if lightning is not activated (fix #5896).
Fix parameters of sweepstore.add_sweep_tx, rm dead code.
2020-02-02 12:10:10 +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
SomberNight
bafe8a2fff
integrate PSBT support natively. WIP 2019-11-04 22:24:36 +01:00
SomberNight
ccccaf099f
(trivial) logging "verbosity_filter" was renamed to "LOGGING_SHORTCUT" 2019-10-30 03:24:26 +01:00
SomberNight
75902f8e35
fix logic error in lnworker.on_channel_closed 2019-10-29 20:39:58 +01:00
ThomasV
215dc96de7 define LNWatcher.do_breach_remedy 2019-09-11 11:58:28 +02:00
SomberNight
befa8ea771
transaction: kill "name", "csv_delay", "cltv_expiry" fields 2019-09-09 19:38:35 +02:00
ThomasV
e5502a58ba uncomment breach_remedy in watchtower 2019-09-09 18:49:14 +02:00
ThomasV
de29fe6930 remove unused import 2019-08-20 09:03:12 +02:00
ThomasV
740381e993 fix: remove unused parameter to add_sweep_tx 2019-08-20 09:03:12 +02:00
ThomasV
f7c05f2602 Synchronize watchtower asynchronously:
- remove remote_commitment_to_be_revoked
- pass old ctns to lnsweep.create_sweeptxs_for_watchtower
- store the ctn of sweeptxs in sweepStore database
- request the highest ctn from sweepstore using get_ctn
- send sweeptxs asynchronously in LNWallet.sync_with_watchtower
2019-08-20 09:03:12 +02:00
ThomasV
2be68ac4d2 Use one LNWatcher instance per wallet 2019-08-20 09:03:12 +02:00
ThomasV
c7b9bdc5f5 lnwatcher: wait until lnwatcher is fully synchronized before check_onchain_situation 2019-08-20 09:03:12 +02:00
ThomasV
a8ce8109be Perform breach remedy without sweepstore:
- add functions to lnsweep
 - lnworker: analyze candidate ctx and htlc_tx
 - watchtower will be optional
 - add test for breach remedy with spent htlcs
 - save tx name as label
2019-08-20 09:03:12 +02:00
ThomasV
238f3c949c get rid of sql_alchemy 2019-08-20 09:03:12 +02:00
ThomasV
f2d58d0e3f optimize channel_db:
- use python objects mirrored by sql database
 - write sql to file asynchronously
 - the sql decorator is awaited in sweepstore, not in channel_db
2019-08-20 09:03:12 +02:00
ThomasV
7be4cdaf18 redeem htlcs:
- fix bug in lnsweep: lnwatcher transactions were indexed by prev_txid
 - add test for breach remedy with unsettled htlcs
 - add timeout option to lnpay, and replace DO_NOT_SETTLE with SETTLE_DELAY
   so that we can read intermediate commitment tx in regtest
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
ThomasV
32e517f407 improve lightning_dialog GUI settings 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