ThomasV
c478f3bb91
channel backups: fix exception in raised after channel is force closed
...
Traceback (most recent call last):
File "/opt/electrum/electrum/util.py", line 1056, in wrapper
return await func(*args, **kwargs)
File "/opt/electrum/electrum/lnwatcher.py", line 183, in on_network_update
await callback()
File "/opt/electrum/electrum/lnwatcher.py", line 200, in check_onchain_situation
keep_watching = await self.do_breach_remedy(funding_outpoint, closing_tx, spenders)
File "/opt/electrum/electrum/lnwatcher.py", line 377, in do_breach_remedy
sweep_info_dict = chan.sweep_ctx(closing_tx)
File "/opt/electrum/electrum/lnchannel.py", line 227, in sweep_ctx
our_sweep_info = self.create_sweeptxs_for_our_ctx(ctx)
File "/opt/electrum/electrum/lnchannel.py", line 216, in create_sweeptxs_for_our_ctx
return create_sweeptxs_for_our_ctx(chan=self, ctx=ctx, sweep_address=self.sweep_address)
File "/opt/electrum/electrum/lnchannel.py", line 321, in sweep_address
assert self.lnworker.wallet.is_mine(addr)
AssertionError
5 years ago
bitromortac
7a62074f8e
lnchannel: reflect frozen amounts and disconnected channels
...
in the num_sats_can_send/receive methods of the lnwallet.
5 years ago
SomberNight
ee24c74f19
lnchan.receive_revocation: tolerate not having htlc fail reason
...
If we get a revack after reestablish, but the fail_htlc was already
committed in a previous app-session, the fail_htlc will not be re-sent and
we will not have the reason (as it's not persisted).
fixes #6675
5 years ago
ghost43
3eba26b398
LN cooperative close: avoid address-reuse ( #6590 )
...
Previously if we coop-closed multiple channels in the same session,
they would reuse the wallet address.
5 years ago
SomberNight
aba2e0f55a
lnhtlc: add all_htlcs_ever, get_htlc_by_id, was_htlc_failed and use them
...
towards encapsulation of hm.log
5 years ago
SomberNight
d5f368c584
LN invoices: support msat precision
...
fixes #6250
6 years ago
ThomasV
b06daaa669
fix display of short_channel_id for channel backups
6 years ago
SomberNight
b55f6430f2
lnchannel: explain why if REMOTE f-closes we remain OPEN until mined
6 years ago
SomberNight
561ecaa226
follow-up prev
6 years ago
SomberNight
996799d79e
lnchannel: update_fee: improve "can afford" check
6 years ago
SomberNight
e59eb147c0
lnchannel.available_to_spend: LOCAL now respects "fee spike buffer"
6 years ago
SomberNight
ccf50dc980
lnchannel.available_to_spend: minor refactor
6 years ago
SomberNight
7fccd4fc5e
lnchannel.available_to_spend: consider both receiver's and sender's ctx
6 years ago
ThomasV
0c17954d37
do not create backups for channels that do not have static_remotekey
6 years ago
ThomasV
6058829870
Use attr.s classes for invoices and requests:
...
- storage upgrade
- fixes #6192
- add can_pay_invoice, can_receive_invoice to lnworker
6 years ago
ThomasV
2adbbee5fe
Add extra state to distinguish shutdown negotiation from post-
...
negotiation, where channel should not be reestablished. See #6182
6 years ago
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.
6 years ago
ThomasV
984da7515a
fix #6125 : detect self-payments
6 years ago
SomberNight
62be1cc367
small clean-up re "extract preimage from on-chain htlc_tx"
...
related: #6122
6 years ago
ThomasV
d7b853f271
follow-up 8ba7e68064
6 years ago
ThomasV
c1b1638615
fix htlc forwarding:
...
- persist fail_htlc error messages
- do not rely on payment_hash in htlc_switch
6 years ago
ThomasV
8ba7e68064
fix #6122 : extract preimage from on-chain htlc_tx
6 years ago
ThomasV
123b8c1792
(minor) rename chan.sweep_htlc
6 years ago
SomberNight
f5eb91900a
use correct feerate when sweeping htlcs
...
fixes #6131
6 years ago
SomberNight
f52072e169
follow-up prev
...
we can't just test with a 1 msat htlc as that might be below htlc_minimum_msat
6 years ago
ThomasV
9224404108
Move callback manager out of Network class
6 years ago
SomberNight
12283d625b
(trivial) rename lnchannel.channel_states to ChannelState
6 years ago
SomberNight
8e8ab775eb
lnchannel: make AbstractChannel inherit ABC
...
and add some type annotations, clean up method signatures
6 years ago
ThomasV
e50f6d29ed
export channel backup from kivy gui
6 years ago
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.
6 years ago
ThomasV
8f41aeb783
Replace wallet backup with channel backups
...
- channels can be backed up individually
- backups are added to lnwatcher
- AbstractChannel ancestor class
6 years ago
ThomasV
55d0a9587e
move maybe_save_short_chan_id to lnchannel
6 years ago
ThomasV
aa32e31a3d
follow-up previous commit
6 years ago
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()
6 years ago
ThomasV
5067166e1e
move should_channel_be_closed_due_to_expiring_htlcs into Channel class
6 years ago
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().
6 years ago
SomberNight
4c10a830f3
lnmsg: rewrite LN msg encoding/decoding
6 years ago
SomberNight
79d57784c1
lnchannel: add more type hints
6 years ago
SomberNight
db84de5493
trivial: use "chunks()" for htlc_sigs in lnchannel
6 years ago
SomberNight
8ad6d5ddda
lnchannel: clean-up docstrings a bit
...
Removed lnd copyright as by now everything covered in this file
has been rewritten.
6 years ago
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.
6 years ago
SomberNight
7498271927
follow-up prev: htlc direction madness
...
Sometimes direction was relative sometimes absolute... ?!
No. Make it always relative (to subject).
6 years ago
SomberNight
5b7ce98ab2
lnchannel: fix included_htlcs
6 years ago
SomberNight
3ed6afce64
lnchannel: implement freezing channels (for receiving)
...
A bit weird, I know... :)
It allows for rebalancing our own channels! :P
6 years ago
SomberNight
5c8455d00b
lnchannel: when adding HTLCs, run checks for both directions
6 years ago
SomberNight
53c6fc8cf1
lnchannel: test for max htlc value (needs to be below protocol maximum)
6 years ago
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)
6 years ago
SomberNight
deb50e7ec3
lnchannel: implement "freezing" channels (for sending)
...
and expose it in Qt GUI
6 years ago
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...
6 years ago
SomberNight
b524460fdf
lnpeer: implement basic handling of "update_fail_malformed_htlc"
6 years ago