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
SomberNight
3a2ab149b9
lnchannel: add_htlc and receive_htlc now take and return UpdateAddHtlc
...
also fix undefined vars in _maybe_forward_htlc and _maybe_fulfill_htlc
in lnpeer
2019-08-20 09:03:11 +02:00
ThomasV
459f9aaee7
lnchannel: reformatting
2019-08-20 09:03:11 +02:00
ThomasV
5d26f51ad0
lnchannel: fix error message
2019-08-20 09:03:11 +02:00
ThomasV
a40207cbbb
Refactor LNPeer in order to support HTLC forwarding:
...
1. Do not perform channel updates in coroutines, because they would get executed in random order.
2. After applying channel updates, wait only for the relevant commitment (local or remote) and not for both, because local and remote might be out of sync (BOLT 2).
3. When waiting for a commitment, wait until a given ctn has been reached, because a queue cannot be shared by several coroutines
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