Commit graph

450 commits

Author SHA1 Message Date
SomberNight
530a446172
follow-up prev: don't reuse funding tx change address for static_remotekey
see comment in code
2020-05-22 17:19:55 +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
SomberNight
f8c574b699
wallet: (fix) get_receiving_address must always return an addr
- also, disallow deleting last address from an imported wallet (fixes #3254, fixes #4833)
- also, set LNBackups.sweep_address lazily, as during fresh wallet creation
  there are no addresses in the wallet at that point yet! see trace below.

Traceback (most recent call last):
  [...]
  File "...\electrum\electrum\tests\test_commands.py", line 112, in test_export_private_key_deterministic
    wallet = restore_wallet_from_text('bitter grass shiver impose acquire brush forget axis eager alone wine silver',
  File "...\electrum\electrum\wallet.py", line 2575, in restore_wallet_from_text
    wallet = Wallet(db, storage, config=config)
  File "...\electrum\electrum\wallet.py", line 2502, in __new__
    wallet = WalletClass(db, storage, config=config)
  File "...\electrum\electrum\wallet.py", line 2346, in __init__
    Deterministic_Wallet.__init__(self, db, storage, config=config)
  File "...\electrum\electrum\wallet.py", line 2147, in __init__
    Abstract_Wallet.__init__(self, db, storage, config=config)
  File "...\electrum\electrum\wallet.py", line 261, in __init__
    self.lnbackups = LNBackups(self)
  File "...\electrum\electrum\lnworker.py", line 1401, in __init__
    self.sweep_address = wallet.get_receiving_address()
  File "...\electrum\electrum\wallet.py", line 1498, in wrapper
    addr = func(self, *args, **kwargs)
  File "...\electrum\electrum\wallet.py", line 1520, in get_receiving_address
    raise Exception("no receiving addresses in wallet?!")
Exception: no receiving addresses in wallet?!
2020-05-22 16:25:33 +02:00
SomberNight
f9de6a5354
tests: lnpeer: make debug htlc failure hooks more uniform 2020-05-14 19:15:32 +02:00
SomberNight
c034219c5a
ln invoices: more relaxed filtering of chans to include route hints for
e.g. just because remote peer is temporarily offline, we might still want it
included in the invoice
2020-05-11 16:01:33 +02:00
ThomasV
1788e5c1c0 lnworker: catch exceptions raised in decode_msg 2020-05-11 10:31:49 +02:00
ThomasV
e2c2c89988 follow-up prev 2020-05-10 22:11:09 +02:00
ThomasV
0070e5036c follow-up previous commit 2020-05-10 21:45:10 +02:00
ThomasV
984da7515a fix #6125: detect self-payments 2020-05-06 12:58:55 +02:00
SomberNight
cc4029c335
test_lnpeer: add some multi-hop payment unit tests 2020-05-06 11:06:44 +02:00
SomberNight
7153e753d1
lnworker._pay: allow specifying path as argument
not exposed to CLI/etc yet but will be used in tests soon
2020-05-06 11:06:40 +02:00
SomberNight
7951f2ed3b
lnworker.pay: small clean-up 2020-05-06 04:02:59 +02:00
SomberNight
7d3eb5d4db
(trivial) follow-up c1b1638615 2020-05-06 04:01:56 +02:00
ThomasV
7b44e27087 lnpay: return payment log, increase timeout 2020-05-05 18:32:43 +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
abe1bece2c remove UnknownPaymentHash (exception used as value) 2020-05-02 22:37:28 +02:00
SomberNight
2b1a150c52
multi-wallet: properly stop lnworker/lnwatcher 2020-05-01 04:50:08 +02:00
SomberNight
6f7a4ab048
lnpeer: add get_channel_by_id, for small speed-up 2020-04-30 21:13:29 +02:00
SomberNight
b9b53e7f76
lnworker: fix threading issues for .channels attribute
external code (commands/gui) did not always take lock when iterating lnworker.channels.
instead of exposing lock, let's take a copy internally (as with .peers)
2020-04-30 21:08:26 +02:00
ThomasV
f4dc93cb7d lnworker: blacklist channel if policy is unchanged but has a new timestamp. 2020-04-24 12:16:21 +02:00
ThomasV
2d0ef78a11 channel_db: add verbose option to add_channel_update 2020-04-24 11:45:39 +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
SomberNight
12d771737a
fix #6096: bugfix for creating zero amount LN invoice
(also there was a unit-mismatch here...)
2020-04-18 05:56:12 +02:00
ThomasV
ef5ad5f22f extend 'add_peer', 'list_peers' commands to gossip 2020-04-16 12:39:12 +02:00
SomberNight
82da581d45
lnworker: clear peer retry times if proxy settings change
maybe there were failures due to the previous proxy details being incorrect
2020-04-15 22:47:14 +02:00
SomberNight
95fa5d37c3
lnworker.peers: follow-up b5811e8072
somehow I forgot writes...
2020-04-15 22:41:16 +02:00
SomberNight
223b62554e
lntransport: use network proxy if available
fixes #4824
2020-04-15 21:44:09 +02:00
SomberNight
b5811e8072
lnworker.peers: fix threading issues 2020-04-15 21:43:58 +02:00
SomberNight
76f0ad3271
util: add NetworkRetryManager, a baseclass for LNWorker and Network 2020-04-15 17:24:07 +02:00
SomberNight
90cb032721
lnworker: implement exponential backoff for retries 2020-04-15 17:24:04 +02:00
ThomasV
9224404108 Move callback manager out of Network class 2020-04-14 18:29:51 +02:00
ThomasV
73325831b7 run lnworker.main_loop directly on the event loop 2020-04-14 18:28:23 +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
bddb0bfcdd Do not wait wallet sync to reestablish channel (revert e32807d29d). 2020-04-13 11:30:52 +02:00
ThomasV
99f933401a add more logging shortcuts 2020-04-12 12:30:59 +02:00
SomberNight
9a88c13b3d
translations: add note that f-strings cannot be translated
and replace current usage
2020-04-11 16:33:45 +02:00
ThomasV
312ef15cd6 fix #6056 2020-04-11 12:02:38 +02:00
ThomasV
e50f6d29ed export channel backup from kivy gui 2020-04-10 20:04:24 +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
5efaaa523a lnworker: check chain_hash when decoding channel update. 2020-04-09 15:16:07 +02:00
ThomasV
6307e13549 do not print the entire payment log again, this is redundant 2020-04-08 09:46:16 +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
9ca445bd5d save_short_chan_id: remove unneeded ćalls to lnwatcher 2020-04-03 12:59:56 +02:00
ThomasV
764c18b3c8 follow-up prev commit 2020-04-02 17:36:18 +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
1be0a710c3
ln: implement option payment_secret 2020-04-01 21:49:12 +02:00