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
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
049857d528
on_revoke_and_ack: be robust to exceptions raised in lnwatcher
2019-08-20 09:03:12 +02:00
ThomasV
d9b041e64d
encapsulate detect_who_closed in channel
2019-08-20 09:03:11 +02:00
SomberNight
69bffac86a
lnhtlc: fix adding htlc between sending commitment_signed and receiving revoke_and_ack
2019-08-20 09:03:11 +02:00
ThomasV
8d99fe8243
Let lnworker sweep HTLC outputs after breach, instead of lnwatcher
2019-08-20 09:03:11 +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
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
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
670424f080
get_payments: do not include failed payments
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
SomberNight
f47519bdf3
lnchan: make_commitment and balance (follow-up prev)
...
"balance(self, subject, ctn=None)" is underspecified.
whose balance? whose commitment transaction?
this lead to issues...
2019-08-20 09:03:11 +02:00
SomberNight
8632f027da
lnhtlc: small clean-up / docstrings
2019-08-20 09:03:11 +02:00
ThomasV
e7218d798d
add get_channel_ctx to CLI, for testing breaches
2019-08-20 09:03:11 +02:00
ThomasV
023d4026b9
fix local_index in channel _shutdown
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
a7d37b72db
factorize channel opening code into chan.open_with_first_pcp
2019-08-20 09:03:11 +02:00
ThomasV
c3f6351922
simplify points, remove side-effect in reestablish_channel
2019-08-20 09:03:11 +02:00
ThomasV
82491ff083
do not duplicate ctn in channel log and config
2019-08-20 09:03:11 +02:00
ThomasV
3e443535a2
lnchannel: pass reference to lnworker
2019-08-20 09:03:11 +02:00
ThomasV
a8e2f79563
lnchannel: save timestamp when we settle
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
Janus
f618bb4a67
lnhtlc: handle settles like adds (asymmetrical across ctns)
2019-08-20 09:03:11 +02:00