Commit graph

131 commits

Author SHA1 Message Date
SomberNight
4c7a92f39c
bitcoin: implement construct_script and use it 2020-10-24 07:49:06 +02:00
SomberNight
89bd520185
bitcoin: move construct_witness from transaction.py to bitcoin.py 2020-10-24 05:18:16 +02:00
SomberNight
261ad804ca
invoices: always validate that LNInvoice.invoice can be decoded
related: #6559

The LNInvoice.from_json() method previously did not validate, which is
used by e.g. wallet.import_invoices.
2020-09-11 19:57:42 +02:00
SomberNight
9fa666f179
fix channel backups with old "cryptography" module
closes #6314
2020-07-02 11:07:10 +02:00
SomberNight
89ddc1345d
lnutil.PaymentAttemptLog: fix error formatting
fixes #6249
2020-06-22 03:40:04 +02:00
SomberNight
ea329063bf
channel open: allow REMOTE to set htlc_minimum_msat to 0
non-positive values do not make sense... but some nodes set it to 0
and if we enforce >= 1 then we can't open channels with those...
lnchannel._assert_can_add_htlc enforces positive values for HTLCs in any case.
2020-06-19 18:15:09 +02:00
SomberNight
3665f5d3fd
fix channel backups for "not initiator" channels
bool(b'\x00') is True
2020-06-19 06:53:45 +02:00
SomberNight
e1a2299f0c channel backup versions: trivial clean-up 2020-06-18 15:03:16 +02:00
ThomasV
6922d81a1e channel backups: add another version number, for the backup itself 2020-06-18 15:03:16 +02:00
SomberNight
996799d79e
lnchannel: update_fee: improve "can afford" check 2020-06-15 16:10:12 +02:00
SomberNight
817411b889
ChannelConfig: add some clarifications 2020-06-15 14:39:42 +02:00
SomberNight
5b4d46299a
ChannelConfig.validate_params: fix sat/msat unit mismatch
follow-up fc39295d20
2020-06-09 20:23:52 +02:00
SomberNight
3509343447
ln: make 'to_self_delay' CSV configurable
needed for tests
2020-06-09 18:36:34 +02:00
SomberNight
fc39295d20
lnpeer: review safety check re channel open flow, and tweak params 2020-06-08 21:17:23 +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
f5eb91900a
use correct feerate when sweeping htlcs
fixes #6131
2020-04-30 19:37:06 +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
8e8ab775eb
lnchannel: make AbstractChannel inherit ABC
and add some type annotations, clean up method signatures
2020-04-13 15:57:53 +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
f3995350e8 localconfig: rename seed to channel_seed 2020-04-06 16:53:48 +02:00
SomberNight
08bc8617ad
change derivation of ln channel keys: use hardened paths 2020-04-06 12:53:57 +02:00
ThomasV
0ea21c59d2 Save channel seed in localconfig 2020-04-04 13:28:19 +02:00
ThomasV
aa32e31a3d follow-up previous commit 2020-04-03 18:54:02 +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
30bf32b34b
use option varonion: actually use TLV payloads, and signal support 2020-04-01 21:47:42 +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
79d57784c1
lnchannel: add more type hints 2020-03-30 03:49:50 +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
90f3b667aa
small clean-up re max CLTV delta for LN 2020-03-30 02:46:14 +02:00
SomberNight
5b7ce98ab2
lnchannel: fix included_htlcs 2020-03-27 19:06:30 +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
ea0981ebeb
lnutil.UpdateAddHtlc: use attrs instead of old-style namedtuple 2020-03-17 20:31:11 +01:00
ThomasV
444610452e wallet_db: encapsulate type conversions with attr.s converter 2020-03-17 11:04:49 +01:00
ThomasV
6c2ef176cc kivy: show payment log details 2020-03-10 16:44:23 +01:00
ThomasV
15fb8c0415 allow transition from FORCE_CLOSING to REDEEMED. define REDEEM_AFTER_DOUBLE_SPENT_DELAY 2020-03-06 11:40:08 +01:00
SomberNight
a97e7bae05
ChannelDB: make gossip sync progress updates cheaper
get_num_channels_partitioned_by_policy_count() was too slow
2020-03-02 16:56:15 +01:00
SomberNight
6161853941
lnpeer: reduce log spam due to incompatible feature bits 2020-02-26 21:10:33 +01:00
ThomasV
6e5abc049b follow-up previous commit (backward compatibility) 2020-02-21 15:33:15 +01:00
ThomasV
55e0e1a72e Generate channel keys from random seed 2020-02-21 12:38:12 +01:00
ThomasV
86d1e50469 select peers with desired features before connecting 2020-02-21 10:57:13 +01:00
ThomasV
2255b07157 support option_static_remotekey 2020-02-20 21:02:01 +01:00
SomberNight
16626a3386
lnutil.split_host_port: fix for IPv6 connection string 2020-02-17 19:43:21 +01:00