Commit Graph

153 Commits

Author SHA1 Message Date
SomberNight d5f368c584 LN invoices: support msat precision
fixes #6250
2020-06-22 22:48:13 +02:00
ThomasV b06daaa669 fix display of short_channel_id for channel backups 2020-06-19 19:38:19 +02:00
SomberNight b55f6430f2 lnchannel: explain why if REMOTE f-closes we remain OPEN until mined 2020-06-19 16:31:09 +02:00
SomberNight 561ecaa226 follow-up prev 2020-06-19 04:13:41 +02:00
SomberNight 996799d79e lnchannel: update_fee: improve "can afford" check 2020-06-15 16:10:12 +02:00
SomberNight e59eb147c0 lnchannel.available_to_spend: LOCAL now respects "fee spike buffer" 2020-06-15 15:43:41 +02:00
SomberNight ccf50dc980 lnchannel.available_to_spend: minor refactor 2020-06-15 14:39:57 +02:00
SomberNight 7fccd4fc5e lnchannel.available_to_spend: consider both receiver's and sender's ctx 2020-06-15 14:39:54 +02:00
ThomasV 0c17954d37 do not create backups for channels that do not have static_remotekey 2020-06-06 12:28:08 +02:00
ThomasV 6058829870 Use attr.s classes for invoices and requests:
- storage upgrade
 - fixes #6192
 - add can_pay_invoice, can_receive_invoice to lnworker
2020-06-01 21:02:45 +02:00
ThomasV 2adbbee5fe Add extra state to distinguish shutdown negotiation from post-
negotiation, where channel should not be reestablished. See #6182
2020-05-29 18:00:52 +02:00
SomberNight 6040e953a3 wallet: implement reserving addresses, and use it for LN SRK to_remote
- Use change addresses (instead of receive) for the static_remotekey to_remote outputs,
  and reserve these to greatly reduce the chance of address-reuse
- Use change addresses (instead of receive) for LN channel sweep addresses.
  Note that these atm are not getting reserved.
2020-05-22 17:19:51 +02:00
ThomasV 984da7515a fix #6125: detect self-payments 2020-05-06 12:58:55 +02:00
SomberNight 62be1cc367 small clean-up re "extract preimage from on-chain htlc_tx"
related: #6122
2020-05-06 03:15:20 +02:00
ThomasV d7b853f271 follow-up 8ba7e68064 2020-05-05 15:40:13 +02:00
ThomasV c1b1638615 fix htlc forwarding:
- persist fail_htlc error messages
 - do not rely on payment_hash in htlc_switch
2020-05-05 09:23:48 +02:00
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 f5eb91900a use correct feerate when sweeping htlcs
fixes #6131
2020-04-30 19:37:06 +02:00
SomberNight f52072e169 follow-up prev
we can't just test with a 1 msat htlc as that might be below htlc_minimum_msat
2020-04-18 18:51:20 +02:00
ThomasV 9224404108 Move callback manager out of Network class 2020-04-14 18:29:51 +02:00
SomberNight 12283d625b (trivial) rename lnchannel.channel_states to ChannelState 2020-04-13 16:02:05 +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 e50f6d29ed export channel backup from kivy gui 2020-04-10 20:04:24 +02:00
ThomasV 74517c88ad do not use short_channel_id as state, use channel state for that.
display it as soon as the funding tx is mined.
2020-04-10 15:10:50 +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 55d0a9587e move maybe_save_short_chan_id to lnchannel 2020-04-06 18:35:12 +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
ThomasV 5067166e1e move should_channel_be_closed_due_to_expiring_htlcs into Channel class 2020-04-02 17:18:50 +02:00
SomberNight 3a73f6ee5c lnmsg.decode_msg: dict values for numbers are int, instead of BE bytes
Will be useful for TLVs where it makes sense to do the conversion in lnmsg,
as it might be more complicated than just int.from_bytes().
2020-04-01 21:39:52 +02:00
SomberNight 4c10a830f3 lnmsg: rewrite LN msg encoding/decoding 2020-04-01 21:39:48 +02:00
SomberNight 79d57784c1 lnchannel: add more type hints 2020-03-30 03:49:50 +02:00
SomberNight db84de5493 trivial: use "chunks()" for htlc_sigs in lnchannel 2020-03-30 02:46:25 +02:00
SomberNight 8ad6d5ddda lnchannel: clean-up docstrings a bit
Removed lnd copyright as by now everything covered in this file
has been rewritten.
2020-03-30 02:46:21 +02:00
SomberNight acb0d7ebac lnchannel: better checks for "update_add_htlc"
I believe this now implements all the checks listed in BOLT-02 for
update_add_htlc, however, the BOLT is sometimes ambiguous,
and actually the checks listed there IMO are insufficient.
There are still some TODOs, in part because of the above.
2020-03-30 02:46:18 +02:00
SomberNight 7498271927 follow-up prev: htlc direction madness
Sometimes direction was relative sometimes absolute... ?!
No. Make it always relative (to subject).
2020-03-28 16:29:39 +01:00
SomberNight 5b7ce98ab2 lnchannel: fix included_htlcs 2020-03-27 19:06:30 +01:00
SomberNight 3ed6afce64 lnchannel: implement freezing channels (for receiving)
A bit weird, I know... :)
It allows for rebalancing our own channels! :P
2020-03-26 09:05:15 +01:00
SomberNight 5c8455d00b lnchannel: when adding HTLCs, run checks for both directions 2020-03-26 09:05:08 +01:00
SomberNight 53c6fc8cf1 lnchannel: test for max htlc value (needs to be below protocol maximum) 2020-03-26 09:05:00 +01:00
SomberNight 777e350fae lnchannel: partly fix available_to_spend
we were looking at inconsistent ctns
and we were looking at the wrong subject's ctx

all the FIXMEs and TODOs here will still warrant some attention.

(note that test_DesyncHTLCs was passing incorrectly:
the "assertRaises" was catching a different exception)
2020-03-26 09:04:55 +01:00
SomberNight deb50e7ec3 lnchannel: implement "freezing" channels (for sending)
and expose it in Qt GUI
2020-03-26 03:32:44 +01:00
SomberNight 2cc76fbbbd lnworker: fix type error re pending_payments, and impl malformed htlcs
In old code, in lnpeer.htlc_switch(), "error" in lnworker.pending_payments
had incorrect type.

TODO: we need tests for payment failures...
2020-03-17 20:32:38 +01:00
SomberNight b524460fdf lnpeer: implement basic handling of "update_fail_malformed_htlc" 2020-03-17 20:31:50 +01:00
SomberNight ea0981ebeb lnutil.UpdateAddHtlc: use attrs instead of old-style namedtuple 2020-03-17 20:31:11 +01:00
ThomasV 5bac2fea98 Qt: improve channel details window 2020-03-12 12:40:50 +01:00
ThomasV fe2b40b83d Fix #6021: Do not transition channel state to CLOSED if tx is unconfirmed. 2020-03-11 11:49:53 +01:00
ThomasV 05a191cc6a (minor) simplification 2020-03-09 19:10:03 +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