Commit graph

369 commits

Author SHA1 Message Date
SomberNight
f9de6a5354
tests: lnpeer: make debug htlc failure hooks more uniform 2020-05-14 19:15:32 +02:00
ThomasV
d3fb68575d daemon.py: Add authentication to Watchtower.
Define abstract class AuthenticatedServer
2020-05-12 10:12:30 +02:00
ThomasV
2fed218452 follow-up prev commit (fix regtest) 2020-05-12 09:22:39 +02:00
ThomasV
11aaa0b66f Simplify services (watchtower, payserver):
- Do not expose services settings in GUI
 - Use a single netaddress configuration variable.
2020-05-10 14:52:50 +02:00
SomberNight
619f8555f5
follow-up prev: trivial rename
Just realised that the "diamond" graph is actually defined in Graph Theory
but it has an extra edge. What we have here is apparently called a "square" graph.
Not that it matters much but might as well name it as such then...
2020-05-06 11:27:50 +02:00
SomberNight
cc4029c335
test_lnpeer: add some multi-hop payment unit tests 2020-05-06 11:06:44 +02:00
SomberNight
63b18dc30f
lnrouter: add PathEdge/LNPaymentPath for (node_id, scid) 2020-05-06 11:06:37 +02:00
SomberNight
04d018cd0f
test_lnpeer: some clean-up, make it easier to add "num_node>2" tests 2020-05-06 11:06:33 +02:00
ThomasV
5c05c06bf0 follow-up prev commit: fix test_lnpeer 2020-05-05 21:18:17 +02:00
ThomasV
7cbb102c81 add test with fail_malformed_htlc to forwarding regtest 2020-05-05 09:04:17 +02:00
ThomasV
ab188ff375 add config variable to test update_fail_malformed_htlc 2020-05-04 20:31:44 +02:00
ThomasV
8ba7e68064 fix #6122: extract preimage from on-chain htlc_tx 2020-05-03 16:03:27 +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
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
1600241b02
fix tests: follow-up prev few commits 2020-04-15 17:39:39 +02:00
ThomasV
ef2ff11926 fix tests (follow-up prev commit) 2020-04-14 18:35:50 +02:00
SomberNight
54e1520ee4
ln: check if chain tip is stale when receiving HTLC
if so, don't release preimage / don't forward HTLC
2020-04-13 17:04:27 +02:00
SomberNight
12283d625b
(trivial) rename lnchannel.channel_states to ChannelState 2020-04-13 16:02:05 +02:00
ThomasV
e50f6d29ed export channel backup from kivy gui 2020-04-10 20:04:24 +02:00
SomberNight
7dabbdd082
tests_lnpeer: trivial fix 2020-04-08 13:18:56 +02:00
SomberNight
1ea89af012
crypto.pw_decode: fix one case of raising incorrect exception 2020-04-08 12:49:50 +02:00
ThomasV
d2a58a2ec3 lnpeer: do not assume our privkey is the same as lnworker's privkey. 2020-04-06 19:06:27 +02:00
ThomasV
f3995350e8 localconfig: rename seed to channel_seed 2020-04-06 16:53:48 +02:00
ThomasV
0ea21c59d2 Save channel seed in localconfig 2020-04-04 13:28:19 +02:00
SomberNight
71635216df
ln feature bits: validate transitive feature deps everywhere 2020-04-01 21:49:19 +02:00
SomberNight
1be0a710c3
ln: implement option payment_secret 2020-04-01 21:49:12 +02:00
SomberNight
4b78bf94d4
lnaddr: add feature bit support to invoices
see https://github.com/lightningnetwork/lightning-rfc/pull/656
2020-04-01 21:42:52 +02:00
SomberNight
a66437f399
lnonion: implement basis of varonion support 2020-04-01 21:42:48 +02:00
SomberNight
6ba08cc8d4
ln feature bits: flatten namespaces, and impl feature deps and ctxs
This implements:
- flat feature bits https://github.com/lightningnetwork/lightning-rfc/pull/666
- feature bit dependencies https://github.com/lightningnetwork/lightning-rfc/pull/719
2020-04-01 21:41:24 +02:00
SomberNight
c69937395e
lnmsg: add more tests (for encode_msg, decode_msg) 2020-04-01 21:40:13 +02:00
SomberNight
85d7a13360
lnmsg: implement tests from BOLT-01 2020-04-01 21:40:06 +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
900a7631cf
commands: add new cmd "getprivatekeyforpath" to export a WIF for a path
related: #6061
2020-03-31 05:50:18 +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
5c8455d00b
lnchannel: when adding HTLCs, run checks for both directions 2020-03-26 09:05:08 +01:00
SomberNight
01207316aa
storage upgrade: move "htlc_minimum_msat" to base channel config 2020-03-26 09:05:04 +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
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
5e59d1a0ed
lnonion: use random starting bytes in Sphinx packet as in updated BOLT4
see https://github.com/lightningnetwork/lightning-rfc/pull/697
2020-03-16 04:37:52 +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
beac1c4ddc channel_db: raise specific exception if database is not loaded when we try to find a route 2020-03-10 15:13:20 +01:00
ThomasV
2f31e9fa44 follow-up prev commit 2020-03-10 13:51:08 +01:00
SomberNight
c95c0dcb80
lnrouter: add comments about path-finding blocking the asyncio loop 2020-03-09 20:39:13 +01:00
SomberNight
5b23d5ee97
lnchannel/lnhtlc: speed up balance calculation for recent ctns
Move the balance calculation from lnchannel to lnhtlc.
Maintain a running balance in lnhtlc that is coupled with _maybe_active_htlc_ids
for practicality reasons.
2020-03-07 05:05:05 +01:00