Commit graph

81 commits

Author SHA1 Message Date
ThomasV
20d8da7e24 db upgrade: store channel tx height and timestamps in 'channels' 2020-02-24 10:07:55 +01:00
ThomasV
54ef6db762 do not try to reestablish channels in PREOPENING state (per BOLT2). 2020-02-23 14:54:04 +01:00
ThomasV
7771daf94e qt: add menu item to view closing transaction of channel 2020-02-22 12:28:07 +01:00
ThomasV
938d918e55 sweep_ctx: do not log if channel was not force closed 2020-02-22 09:27:34 +01:00
ThomasV
2255b07157 support option_static_remotekey 2020-02-20 21:02:01 +01:00
ThomasV
238fb46d87 Lightning: Show sending and receiving capacity. Fixes #5967 2020-02-19 16:11:55 +01:00
ThomasV
e05cd2006a fix get_payments 2020-02-18 17:40:13 +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
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
SomberNight
a6e3a244e8
add comment re lnchannel channel_states 2020-02-14 16:15:25 +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
ThomasV
beee880dba fix data_loss_protect (missing return, json conversion) 2020-02-12 14:19:31 +01:00
ThomasV
9ccfa318f8 add new peer_state for the case where we are waiting for the remote party to force close a channel 2020-02-11 20:55:52 +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
aa51df0a1a Use attr.s for Feeupdates and Outpoints
Storage upgrade to version 23
2020-02-01 16:45:19 +01:00
ThomasV
757467782a Use attr.s instead of namedtuples for channel config 2020-01-31 12:19:26 +01:00
SomberNight
bda9a407d9
trivial: don't print frequent-case log line in lnpeer.mark_open 2019-11-22 21:37:15 +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
SomberNight
bafe8a2fff
integrate PSBT support natively. WIP 2019-11-04 22:24:36 +01: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
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
788d54f9a6 remove another instance of lnworker accessed in lnchannel 2019-10-09 19:54:43 +02:00
ThomasV
8331f0049c Remove lnpeer.payment_preimages:
- we can await lnworker.pending_payments instead, because the preimage is saved
 - also, remove one instance of lnworker being accessed from lnchannel
2019-10-09 19:40:25 +02:00
SomberNight
04edad9984
config: no longer singleton. it is passed to Wallet.__init__
The few other cases that used SimpleConfig.get_instance() now
either get passed a config instance, or they try to get a reference
to something else that has a reference to a config.
(see lnsweep, qt/qrcodewidget, qt/qrtextedit)
2019-09-22 20:46:01 +02:00
SomberNight
b2920db8b8
config: enforce that SimpleConfig is singleton
related: #5629
2019-09-10 18:01:10 +02:00
SomberNight
befa8ea771
transaction: kill "name", "csv_delay", "cltv_expiry" fields 2019-09-09 19:38:35 +02:00
ThomasV
35761d1241 Save remote policy of chanel in wallet file (for private channels) 2019-09-08 19:14:28 +02:00
SomberNight
83fcdbd561
lnchannel: handle htlc-address collisions
We were previously generating an incorrect commitment_signed msg if there were
multiple htlcs sharing the same scriptPubKey.
2019-09-07 08:54:41 +02:00
SomberNight
509df9ddaf
create class for ShortChannelID and use it 2019-09-06 18:09:05 +02:00
ThomasV
a50f935aec Restructure invoices and requests (WIP)
- Terminology: use 'invoices' for outgoing payments, 'requests' for incoming payments
 - At the GUI level, try to handle invoices in a generic way.
 - Display ongoing payments in send tab.
2019-09-02 15:35:44 +02:00
SomberNight
47ee02569a lnpeer: send own outgoing channel updates to remote peer 2019-08-20 09:03:12 +02:00
SomberNight
0973b86925 lnworker: rework "is_dangerous"
"Should channel be closed due to expiring htlcs?"
2019-08-20 09:03:12 +02:00
SomberNight
ce54b5411e lnhtlc: htlcs_by_direction now returns dict keyed by htlc_id 2019-08-20 09:03:12 +02:00
SomberNight
940fc86749 lnpeer: reestablish_channel - fix data_loss_protect edge case 2019-08-20 09:03:12 +02:00
SomberNight
107f271e58 move all ctn book-keeping to lnhtlc (from lnchannel) 2019-08-20 09:03:12 +02:00
SomberNight
44761972cb lnchannel: ctx output-ordering: identical htlcs are ordered by CLTV 2019-08-20 09:03:12 +02:00
SomberNight
b1f606eaed lnchannel: start using "latest" and "next" instead of "current" and "pending"
"current" used to be "oldest_unrevoked"; and pending was "oldest_unrevoked + 1"
but this was very confusing...
so now we have "oldest_unrevoked", "latest", and "next"
where "next" is "latest + 1"
"oldest_unrevoked" and "latest" are either the same or are offset by 1
(but caller should know which one they need)

rm "got_sig_for_next" - it was a redundant sanity check, that really
just complicated things

rm "local_commitment", "remote_commitment", "set_local_commitment",
"set_remote_commitment" - just use "get_latest_commitment" instead
2019-08-20 09:03:12 +02:00
SomberNight
944e4f0ba0 implement data_loss_protect
so that we can spend their_ctx_to_remote even when we lost our state
but have an old backup
2019-08-20 09:03:12 +02:00
SomberNight
c046f2cc1c lnhtlc: move 'next_htlc_id' from ChannelConfig to lnhtlc log 2019-08-20 09:03:12 +02:00
SomberNight
0d84873a75 lnchannel: trivial clean-up 2019-08-20 09:03:12 +02:00
ThomasV
fa3eefa479 refactor a few lnchannel methods 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
SomberNight
f060e53912 (trivial) fix type annotation 2019-08-20 09:03:12 +02:00
SomberNight
087994e39a lnchannel: move fee update logic to lnhtlc (and hopefully fix it) 2019-08-20 09:03:12 +02:00
ThomasV
3d7f7dfc82 revamp fee updates (draft) 2019-08-20 09:03:12 +02:00
SomberNight
7431aac5cd lnhtlc: (fix) was locking in too many updates during commit/revoke 2019-08-20 09:03:12 +02:00
ThomasV
9045d7b293 cleanup revoke_current_commitment 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