rust-lightning
15 months agoMake `test_duplicate_payment_hash_one_failure_one_success` robust 2023-01-test-robust
Matt Corallo [Wed, 25 Jan 2023 02:56:13 +0000 (02:56 +0000)]
Make `test_duplicate_payment_hash_one_failure_one_success` robust

`test_duplicate_payment_hash_one_failure_one_success` currently
fails if the "wrong" HTLC is picked to be claimed. Given the HTLCs
are identical, there's no way to figure out which we should claim.
The test instead relies on a magic value - the first one is the
right one....unless we change our CSPRNG implementation. When we
try to do so, the test randomly fails.

Here we change one HTLC to a lower amount so we can figure out
which transaction to broadcast to make the test robust against
CSPRNG changes.

15 months agoMerge pull request #1878 from dunxen/2022-11-config-minfinalcltvexpiry
Matt Corallo [Tue, 24 Jan 2023 22:35:55 +0000 (22:35 +0000)]
Merge pull request #1878 from dunxen/2022-11-config-minfinalcltvexpiry

Allow configurable `min_final_cltv_expiry_delta`

15 months agoMerge pull request #1967 from arik-so/2023-01-rename-signer-traits
Arik [Tue, 24 Jan 2023 21:20:26 +0000 (13:20 -0800)]
Merge pull request #1967 from arik-so/2023-01-rename-signer-traits

Split out `EcdsaChannelSigner` method from `BaseSign`, and rename it to `ChannelSigner`

15 months agoAdd new payment type and metadata bytes
Duncan Dean [Thu, 24 Nov 2022 20:31:16 +0000 (22:31 +0200)]
Add new payment type and metadata bytes

Adds two new payment `Method`s for identifying payments with custom
`min_final_cltv_expiry_delta` as payments with LDK or user payment
hashes.

The `min_final_cltv_expiry_delta` value is packed into the first 2
bytes of the expiry timestamp in the payment secret metadata.

15 months agoAdd `min_final_cltv_expiry` parameter to invoice utils
Duncan Dean [Mon, 21 Nov 2022 12:53:52 +0000 (14:53 +0200)]
Add `min_final_cltv_expiry` parameter to invoice utils

All utility functions for invoice construction will now also accept an
Option<>al `min_final_cltv_expiry_delta` which is useful for things like
swaps etc. The `min_final_cltv_expiry_delta` will default back to
`MIN_FINAL_CLTV_EXPIRY_DELTA` if `None` is provided.

15 months agoAdd `_delta` suffix to `min_final_cltv_expiry`
Duncan Dean [Tue, 29 Nov 2022 10:47:00 +0000 (12:47 +0200)]
Add `_delta` suffix to `min_final_cltv_expiry`

This matches the spec and helps avoid any confusion around
naming. We're also then consistent with `cltv_expiry` in an HTLC being
the actual block height value for the CLTV and not a delta.

15 months agoMake `Channel` and `ChannelManager` less particular about their `Signer` type.
Arik Sosman [Fri, 20 Jan 2023 00:41:15 +0000 (16:41 -0800)]
Make `Channel` and `ChannelManager` less particular about their `Signer` type.

15 months agoRename `Sign` to `WriteableEcdsaChannelSigner`.
Arik Sosman [Thu, 19 Jan 2023 23:51:38 +0000 (15:51 -0800)]
Rename `Sign` to `WriteableEcdsaChannelSigner`.

15 months agoSeparate channel-type-agnostic methods into `ChannelSigner` trait.
Arik Sosman [Wed, 18 Jan 2023 04:33:54 +0000 (20:33 -0800)]
Separate channel-type-agnostic methods into `ChannelSigner` trait.

15 months agoRename `BaseSign` to `EcdsaChannelSigner`.
Arik Sosman [Wed, 18 Jan 2023 00:30:32 +0000 (16:30 -0800)]
Rename `BaseSign` to `EcdsaChannelSigner`.

15 months agoMerge pull request #1926 from jkczyz/2022-12-invoice
Matt Corallo [Mon, 23 Jan 2023 23:18:09 +0000 (23:18 +0000)]
Merge pull request #1926 from jkczyz/2022-12-invoice

BOLT 12 `invoice` encoding and building

15 months agoFix unused_imports warning in no-std tests
Jeffrey Czyz [Thu, 19 Jan 2023 04:14:35 +0000 (22:14 -0600)]
Fix unused_imports warning in no-std tests

15 months agoInvoice parsing tests
Jeffrey Czyz [Mon, 16 Jan 2023 05:59:49 +0000 (23:59 -0600)]
Invoice parsing tests

Tests for checking invoice semantics when parsing invoice bytes as
defined by BOLT 12.

15 months agoInvoice building tests
Jeffrey Czyz [Mon, 16 Jan 2023 04:26:52 +0000 (22:26 -0600)]
Invoice building tests

Tests for checking invoice message semantics when building an invoice as
defined by BOLT 12.

15 months agoExpand invoice module docs and include an example
Jeffrey Czyz [Wed, 18 Jan 2023 15:54:13 +0000 (09:54 -0600)]
Expand invoice module docs and include an example

15 months agoUse SystemTime::now() for Invoice creation time
Jeffrey Czyz [Fri, 13 Jan 2023 05:02:39 +0000 (23:02 -0600)]
Use SystemTime::now() for Invoice creation time

For std builds, Invoice::created_at can be automatically set upon
construction using SystemTime::now() offset by SystemTime::UNIX_EPOCH.
Change InvoiceRequest::respond_with and Refund::respond_with to only
take a created_at parameter in no-std builds.

15 months agoBuilder for creating invoices for refunds
Jeffrey Czyz [Tue, 20 Dec 2022 15:33:11 +0000 (09:33 -0600)]
Builder for creating invoices for refunds

Add a builder for creating invoices for a refund and required fields.
Other settings are optional and duplicative settings will override
previous settings. Building produces a semantically valid `invoice`
message for the refund, which then can be signed with the key associated
with the provided signing pubkey.

15 months agoBuilder for creating invoices for offers
Jeffrey Czyz [Tue, 20 Dec 2022 04:23:39 +0000 (22:23 -0600)]
Builder for creating invoices for offers

Add a builder for creating invoices for an offer from a given request
and required fields. Other settings are optional and duplicative
settings will override previous settings. Building produces a
semantically valid `invoice` message for the offer, which then can be
signed with the key associated with the offer's signing pubkey.

15 months agoInvoice encoding and parsing
Jeffrey Czyz [Mon, 12 Sep 2022 14:30:06 +0000 (09:30 -0500)]
Invoice encoding and parsing

Define an interface for BOLT 12 `invoice` messages. The underlying
format consists of the original bytes and the parsed contents.

The bytes are later needed for serialization. This is because it must
mirror all the `offer` and `invoice_request` TLV records, including
unknown ones, which aren't represented in the contents.

Invoices may be created for an Offer (from an InvoiceRequest) or for a
Refund. The primary difference is how the signing pubkey is given -- by
the writer of the offer or the reader of the refund.

15 months agoMerge pull request #1951 from wpaulino/remove-get-node-secret
Matt Corallo [Thu, 19 Jan 2023 03:49:15 +0000 (03:49 +0000)]
Merge pull request #1951 from wpaulino/remove-get-node-secret

15 months agoMerge pull request #1964 from TheBlueMatt/2023-01-no-debug-panics
Arik [Thu, 19 Jan 2023 01:41:54 +0000 (17:41 -0800)]
Merge pull request #1964 from TheBlueMatt/2023-01-no-debug-panics

Use test/_test_utils to enable single-threaded debug assertions

15 months agoRemove NodeSigner::get_node_secret
Wilmer Paulino [Wed, 18 Jan 2023 21:43:32 +0000 (13:43 -0800)]
Remove NodeSigner::get_node_secret

Secrets should not be exposed in-memory at the interface level as it
would be impossible the implement it against a hardware security
module/secure element.

15 months agoUse NodeSigner::ecdh to compute SharedSecrets
Wilmer Paulino [Wed, 18 Jan 2023 21:41:27 +0000 (13:41 -0800)]
Use NodeSigner::ecdh to compute SharedSecrets

15 months agoSign gossip messages with NodeSigner
Wilmer Paulino [Wed, 18 Jan 2023 21:03:20 +0000 (13:03 -0800)]
Sign gossip messages with NodeSigner

15 months agoAdd NodeSigner::sign_gossip_message
Wilmer Paulino [Wed, 18 Jan 2023 21:03:06 +0000 (13:03 -0800)]
Add NodeSigner::sign_gossip_message

Adds signing capability to NodeSigner for all gossip messages that
require a node signature.

15 months agoMerge pull request #1860 from wpaulino/open-channel-anchors-support
Matt Corallo [Thu, 19 Jan 2023 01:00:44 +0000 (01:00 +0000)]
Merge pull request #1860 from wpaulino/open-channel-anchors-support

Support opening anchor channels and test end-to-end unilateral close

15 months agoRemove unused NodeSigner implementations in tests
Wilmer Paulino [Wed, 18 Jan 2023 20:28:42 +0000 (12:28 -0800)]
Remove unused NodeSigner implementations in tests

These implementations have every method panic, so assuming that the test
suite passes, these implementations are never used.

15 months agoAlways set `_test_utils` when building lightning for some tests
Matt Corallo [Tue, 17 Jan 2023 23:39:41 +0000 (23:39 +0000)]
Always set `_test_utils` when building lightning for some tests

This ensures that we hit additional assertions which are intended
to always be run in tests.

15 months agoAdd test yielding anchor-related events
Wilmer Paulino [Thu, 25 Aug 2022 20:39:46 +0000 (13:39 -0700)]
Add test yielding anchor-related events

15 months agoAdd mine_transactions test util
Wilmer Paulino [Thu, 25 Aug 2022 20:39:09 +0000 (13:39 -0700)]
Add mine_transactions test util

15 months agoSupport negotiating anchors throughout channel open
Wilmer Paulino [Thu, 4 Aug 2022 20:22:59 +0000 (13:22 -0700)]
Support negotiating anchors throughout channel open

15 months agoEncoding for TLV stream without signature records
Jeffrey Czyz [Thu, 22 Dec 2022 15:33:41 +0000 (09:33 -0600)]
Encoding for TLV stream without signature records

When using bytes from an InvoiceRequest to constructing bytes for an
Invoice, any signature TLV records in the bytes must be excluded. Define
a wrapper for encoding such pre-serialized bytes in this manner. This
will allow the forthcoming InvoiceBuilder to construct bytes for an
Invoice properly.

15 months agoDefine TlvStream::skip_signatures
Jeffrey Czyz [Thu, 22 Dec 2022 15:10:21 +0000 (09:10 -0600)]
Define TlvStream::skip_signatures

Provide a helper for skipping signature TLV records from a TLV stream.
This prevents needing to duplicate the check for signature TLV records
when writing a TLV stream without signatures in an upcoming commit.

15 months agoDrop AsRef<[u8]> implementation for TlvRecord
Jeffrey Czyz [Thu, 22 Dec 2022 15:04:48 +0000 (09:04 -0600)]
Drop AsRef<[u8]> implementation for TlvRecord

Explicitly using TlvRecord::record_bytes makes reading the code more
obvious than hiding which bytes are used in AsRef<[u8]>::as_ref.

15 months agoMerge pull request #1956 from TheBlueMatt/2023-01-ser-cleanups
Matt Corallo [Wed, 18 Jan 2023 21:31:07 +0000 (21:31 +0000)]
Merge pull request #1956 from TheBlueMatt/2023-01-ser-cleanups

Trivial Serialization Tweaks

15 months agoMerge pull request #1968 from lexe-tech/max/net-tokio-no-arc
Jeffrey Czyz [Wed, 18 Jan 2023 16:26:39 +0000 (10:26 -0600)]
Merge pull request #1968 from lexe-tech/max/net-tokio-no-arc

lightning-net-tokio: Don't require `Arc<PeerManager>`

15 months agolightning-net-tokio: Don't require `Arc<PeerManager>`
Max Fang [Wed, 18 Jan 2023 04:37:10 +0000 (20:37 -0800)]
lightning-net-tokio: Don't require `Arc<PeerManager>`

15 months agoMerge pull request #1962 from TheBlueMatt/2023-01-bp-no-std
Matt Corallo [Tue, 17 Jan 2023 23:48:48 +0000 (23:48 +0000)]
Merge pull request #1962 from TheBlueMatt/2023-01-bp-no-std

Use the user-provided `SleepFuture` for interval checks in `background-processor`

15 months agoUse `test`/`_test_utils` to enable single-threaded debug assertions 2023-01-no-debug-panics
Matt Corallo [Tue, 17 Jan 2023 23:40:44 +0000 (23:40 +0000)]
Use `test`/`_test_utils` to enable single-threaded debug assertions

We have a number of debug assertions which are expected to never
fire when running in a single thread. This is just fine in tests,
and gives us good coverage of our lockorder requirements, but is
not-irregularly surprising to users, who may run with their own
debug assertions in test environments.

Instead, we gate these checks by the `cfg(test)` setting as well as
the `_test_utils` feature, ensuring they run in our own tests, but
not downstream tests.

15 months agoAlways set `_test_utils` when building lightning for some tests
Matt Corallo [Tue, 17 Jan 2023 23:39:41 +0000 (23:39 +0000)]
Always set `_test_utils` when building lightning for some tests

This ensures that we hit additional assertions which are intended
to always be run in tests.

15 months agoMerge pull request #1960 from tnull/2023-01-deref-router-in-invoicepayer
Matt Corallo [Tue, 17 Jan 2023 23:21:22 +0000 (23:21 +0000)]
Merge pull request #1960 from tnull/2023-01-deref-router-in-invoicepayer

Make `InvoicePayer`'s `Router` `Deref`

15 months agoMerge pull request #1957 from TheBlueMatt/2022-01-mon-ref-lockorder
Matt Corallo [Tue, 17 Jan 2023 23:09:05 +0000 (23:09 +0000)]
Merge pull request #1957 from TheBlueMatt/2022-01-mon-ref-lockorder

Pass MonitorUpdates by ref and tweak manager lockorder

15 months agoDefine option_anchors_zero_fee_htlc_tx feature bit
Wilmer Paulino [Tue, 2 Aug 2022 21:48:38 +0000 (14:48 -0700)]
Define option_anchors_zero_fee_htlc_tx feature bit

15 months agoFix stale reference to BaseSign::ready_channel
Wilmer Paulino [Mon, 12 Dec 2022 23:43:40 +0000 (15:43 -0800)]
Fix stale reference to BaseSign::ready_channel

15 months agoAdd missing space in DebugTx logging
Wilmer Paulino [Thu, 8 Dec 2022 18:59:20 +0000 (10:59 -0800)]
Add missing space in DebugTx logging

15 months agoUse a variable-length integer for many serialization wrappers 2023-01-ser-cleanups
Matt Corallo [Mon, 28 Nov 2022 01:00:38 +0000 (01:00 +0000)]
Use a variable-length integer for many serialization wrappers

The lightning protocol uses u16s for lengths in most cases. As our
serialization framework primarily targets that, we must as well.
However, because we may serialize objects that have  more than 65K
entries, we want to be able to store larger values. Thus, we define
a variable length integer here which is backwards-compatible but
treats 0xffff as "read eight more bytes".

This doesn't address any specific known issue, but feels like good
practice just in case.

15 months agoMake `background-processor` no-std-friendly (ish) 2023-01-bp-no-std
Matt Corallo [Tue, 17 Jan 2023 00:16:48 +0000 (00:16 +0000)]
Make `background-processor` no-std-friendly (ish)

This makes `background-processor` build without `std` at all. This
isn't particularly useful in the general no-std case as
`background-processor` is only useful with the `futures` feature,
and async will generally need `std` in some way or another. Still,
it ensures we don't end up reintroducing a dependency on the
current time, which breaks `wasm` use-cases.

15 months agoMerge pull request #1955 from TheBlueMatt/2023-01-1950-message-text
Matt Corallo [Tue, 17 Jan 2023 17:49:29 +0000 (17:49 +0000)]
Merge pull request #1955 from TheBlueMatt/2023-01-1950-message-text

Fix link text in `reply_short_channel_ids_end`

15 months agoMerge pull request #1963 from lexe-tech/max/derive-debug
Matt Corallo [Tue, 17 Jan 2023 17:03:13 +0000 (17:03 +0000)]
Merge pull request #1963 from lexe-tech/max/derive-debug

derive `Debug` for `ConfirmationTarget`

15 months agoderive `Debug` for `ConfirmationTarget`
Max Fang [Tue, 17 Jan 2023 04:15:01 +0000 (20:15 -0800)]
derive `Debug` for `ConfirmationTarget`

15 months agoMerge pull request #1959 from danielgranhao/stop-passing-init-features-in-msg-handlers
Matt Corallo [Tue, 17 Jan 2023 01:26:31 +0000 (01:26 +0000)]
Merge pull request #1959 from danielgranhao/stop-passing-init-features-in-msg-handlers

Stop passing `InitFeatures` in msg handlers

15 months agoMerge pull request #1939 from TheBlueMatt/2022-01-fuzz-hashbrown
Matt Corallo [Tue, 17 Jan 2023 00:55:37 +0000 (00:55 +0000)]
Merge pull request #1939 from TheBlueMatt/2022-01-fuzz-hashbrown

Misc fuzzing tweaks

15 months agoUse the user-provided `SleepFuture` for interval checks in BP
Matt Corallo [Tue, 17 Jan 2023 00:03:43 +0000 (00:03 +0000)]
Use the user-provided `SleepFuture` for interval checks in BP

`background-processor` does a number of jobs on various timers.
Instead of doing those by interrogating `std::time::Instant`, this
change swaps to using the existing user-provided sleep future.

Fixes #1864.

15 months agoUse flexible timer types in background processor's regular jobs
Matt Corallo [Mon, 16 Jan 2023 23:47:11 +0000 (23:47 +0000)]
Use flexible timer types in background processor's regular jobs

`background-processor` does a number of jobs on various timers.
Currently, those are all done by checking the timers every 100ms
by interrogating `std::time::Instant`. This is fine for the
threaded version, but we'd like more flexibility in the `futures`-
based `background-processor`.

Here we swap the `std::time::Instant` interrogation for a lambda
which we will switch out to the user-provided sleeper in the next
commit.

15 months agoMake `InvoicePayer`'s `Router` `Deref`
Elias Rohrer [Mon, 16 Jan 2023 22:54:53 +0000 (16:54 -0600)]
Make `InvoicePayer`'s `Router` `Deref`

As of HEAD the `ChannelManager` is parametrized by a `Router`, while
`InvoicePayer` also owns a `Router`. In order to allow for a single
object being reused, we make the `InvoicePayer` side `Deref`.

15 months agoStop passing `InitFeatures` in msg handlers
Daniel Granhão [Mon, 16 Jan 2023 20:34:59 +0000 (20:34 +0000)]
Stop passing `InitFeatures` in msg handlers

15 months agoSwap per_peer_state lock order 2022-01-mon-ref-lockorder
Matt Corallo [Thu, 12 Jan 2023 02:14:20 +0000 (02:14 +0000)]
Swap per_peer_state lock order

15 months agoPass monitor updates by reference, not owned
Matt Corallo [Sat, 12 Nov 2022 18:26:38 +0000 (18:26 +0000)]
Pass monitor updates by reference, not owned

In the next commit(s) we'll start holding `ChannelMonitorUpdate`s
that are being persisted in `Channel`s until they're done
persisting. In order to do that, switch to applying the updates by
reference instead of value.

15 months agoUse `ChannelUnavailable` for a peer disconnecting not `MisuseError` 2022-01-fuzz-hashbrown
Matt Corallo [Sun, 15 Jan 2023 23:37:00 +0000 (23:37 +0000)]
Use `ChannelUnavailable` for a peer disconnecting not `MisuseError`

This fixes a crash in the `full_stack_target` fuzz test (found by
Chaincode's generous fuzzing infrastructure!) but ultimately is a
better error code - a peer disconnecting before we can fund a
channel isn't a "misuse error" its an unavailable channel.

15 months agoMake fuzz assertions explicit in Cargo.toml
Matt Corallo [Fri, 6 Jan 2023 20:11:27 +0000 (20:11 +0000)]
Make fuzz assertions explicit in Cargo.toml

15 months agoDo not rely on auto-deref'ing when aaccessing a `Hash{Map,Set}`
Matt Corallo [Fri, 6 Jan 2023 20:05:07 +0000 (20:05 +0000)]
Do not rely on auto-deref'ing when aaccessing a `Hash{Map,Set}`

In newer versions of `hashbrown` this code would be broken. While
we aren't updating `hashbrown` any time soon (as it requires an
MSRV bump), it is useful to swap for a newer `hashbrown` when
fuzzing, which this makes easier.

15 months agoSwitch to hashbrown in fuzzing
Matt Corallo [Fri, 6 Jan 2023 19:53:47 +0000 (19:53 +0000)]
Switch to hashbrown in fuzzing

hashbrown by default uses ahash, which may be a bit faster, but
more importantly, if we upgrade to hashbrown 0.13/ahash 0.8 we can
make it use a constant randomization factor, making fuzzers happier.

15 months agoBump fuzz `afl` dependency to latest upstream version
Matt Corallo [Fri, 6 Jan 2023 19:52:24 +0000 (19:52 +0000)]
Bump fuzz `afl` dependency to latest upstream version

15 months agoConvert `Vec` de/serialization impl to a macro and impl for tuples
Matt Corallo [Mon, 28 Nov 2022 00:42:15 +0000 (00:42 +0000)]
Convert `Vec` de/serialization impl to a macro and impl for tuples

...to make it easier to add new implementations and implement it
for all tuples which implement `Readabe` + `Writeable`. Note that
we don't want to just convert to a blanket implementation as we'd
really like to keep our optimized `Vec<u8>` wrapper or we'll end
up spinning way too much when writing vecs of bytes.

15 months agoAdd support for including `ignorable` types in enum de/ser macros
Matt Corallo [Tue, 22 Nov 2022 22:41:13 +0000 (22:41 +0000)]
Add support for including `ignorable` types in enum de/ser macros

An enum implements de/serialization via
`impl_writeable_tlv_based_enum_upgradable` currently cannot contain
an object that only implements `MaybeReadable`.

This solves that by implementing the required blocks for
`ignorable`, opting to return `Ok(None)` in the top-level read in
cases where the inner field read returns `Ok(None)`.

15 months agoImplement (de)serialization for BTreeMap same as HashMap
Matt Corallo [Tue, 22 Nov 2022 21:55:39 +0000 (21:55 +0000)]
Implement (de)serialization for BTreeMap same as HashMap

15 months agoFix link text in `reply_short_channel_ids_end` 2023-01-1950-message-text
Matt Corallo [Sun, 15 Jan 2023 07:01:30 +0000 (07:01 +0000)]
Fix link text in `reply_short_channel_ids_end`

15 months agoMerge pull request #1950 from tnull/2023-01-fix-doc-warnings-and-nits
Matt Corallo [Sun, 15 Jan 2023 07:03:14 +0000 (07:03 +0000)]
Merge pull request #1950 from tnull/2023-01-fix-doc-warnings-and-nits

Fix doc warnings and doc cleanup in `msgs.rs`/`ser.rs`

15 months agoMerge pull request #1946 from wpaulino/init-features-user-config
Matt Corallo [Sun, 15 Jan 2023 04:00:11 +0000 (04:00 +0000)]
Merge pull request #1946 from wpaulino/init-features-user-config

Use UserConfig to determine advertised InitFeatures by ChannelManager

15 months agoMerge pull request #1953 from arik-so/2023-01-debug-gossip-heisenbug
Matt Corallo [Sat, 14 Jan 2023 22:43:26 +0000 (22:43 +0000)]
Merge pull request #1953 from arik-so/2023-01-debug-gossip-heisenbug

15 months agoAllow manually passing a timestamp to `channel_failed`. Fixes #1914.
Arik Sosman [Sat, 14 Jan 2023 16:22:50 +0000 (08:22 -0800)]
Allow manually passing a timestamp to `channel_failed`. Fixes #1914.

15 months agoAdd error messages to stale gossip cleanup assertions.
Arik Sosman [Sat, 14 Jan 2023 15:17:12 +0000 (07:17 -0800)]
Add error messages to stale gossip cleanup assertions.

Should help debug #1914.

15 months agoUse UserConfig to determine advertised InitFeatures by ChannelManager
Wilmer Paulino [Wed, 11 Jan 2023 18:21:29 +0000 (10:21 -0800)]
Use UserConfig to determine advertised InitFeatures by ChannelManager

This is purely a refactor that does not change the InitFeatures
advertised by a ChannelManager. This allows users to configure which
features should be advertised based on the values of `UserConfig`. While
there aren't any existing features currently leveraging this behavior,
it will be used by the upcoming anchors_zero_fee_htlc_tx feature.

The UserConfig dependency on provided_init_features caused most
callsites of the main test methods responsible for opening channels to
be updated. This commit foregos that completely by no longer requiring
the InitFeatures of each side to be provided to these methods. The
methods already require a reference to each node's ChannelManager to
open the channel, so we use that same reference to obtain their
InitFeatures. A way to override such features was required for some
tests, so a new `override_init_features` config option now exists on
the test harness.

15 months agoMerge pull request #1930 from arik-so/2022-12-remove-keysinterface
Matt Corallo [Sat, 14 Jan 2023 04:59:27 +0000 (04:59 +0000)]
Merge pull request #1930 from arik-so/2022-12-remove-keysinterface

Remove KeysInterface

15 months agoFix misc. warnings from `--document-private-items`
Elias Rohrer [Fri, 13 Jan 2023 22:02:41 +0000 (16:02 -0600)]
Fix misc. warnings from `--document-private-items`

15 months agoFix docs and export `impl_tlv_based_enum` variants
Elias Rohrer [Fri, 13 Jan 2023 21:54:14 +0000 (15:54 -0600)]
Fix docs and export `impl_tlv_based_enum` variants

15 months agoFix misc doc warnings.
Elias Rohrer [Fri, 13 Jan 2023 15:18:34 +0000 (09:18 -0600)]
Fix misc doc warnings.

15 months agoFix doc warnings and cleanup in `msgs.rs`
Elias Rohrer [Fri, 13 Jan 2023 15:18:26 +0000 (09:18 -0600)]
Fix doc warnings and cleanup in `msgs.rs`

15 months agoFix doc warnings and cleanup in `ser.rs`
Elias Rohrer [Fri, 13 Jan 2023 13:16:18 +0000 (07:16 -0600)]
Fix doc warnings and cleanup in `ser.rs`

15 months agoDecouple lifetimes for trait implementations that used to comprise KeysInterface.
Arik Sosman [Fri, 13 Jan 2023 00:10:44 +0000 (16:10 -0800)]
Decouple lifetimes for trait implementations that used to comprise KeysInterface.

15 months agoSplit up generic parameters that used to comprise KeysInterface.
Arik Sosman [Tue, 20 Dec 2022 22:46:08 +0000 (14:46 -0800)]
Split up generic parameters that used to comprise KeysInterface.

15 months agoRemove KeysInterface trait.
Arik Sosman [Tue, 20 Dec 2022 22:46:08 +0000 (14:46 -0800)]
Remove KeysInterface trait.

15 months agoMerge pull request #1823 from mariocynicys/expose-tlv-macros2
Matt Corallo [Wed, 11 Jan 2023 21:02:25 +0000 (21:02 +0000)]
Merge pull request #1823 from mariocynicys/expose-tlv-macros2

Expose `impl_writeable_tlv_based` macro

15 months agoMerge pull request #1507 from ViktorTigerstrom/2022-05-store-channels-per-peer
Matt Corallo [Tue, 10 Jan 2023 19:19:35 +0000 (19:19 +0000)]
Merge pull request #1507 from ViktorTigerstrom/2022-05-store-channels-per-peer

Store `channels` per-peer

15 months agoMerge pull request #1944 from TheBlueMatt/2022-01-lockorder-windows-robust
Matt Corallo [Tue, 10 Jan 2023 19:19:25 +0000 (19:19 +0000)]
Merge pull request #1944 from TheBlueMatt/2022-01-lockorder-windows-robust

Make `debug_sync` regex more robust

15 months agoMerge pull request #1943 from andrei-21/feature/handle-read-dir-errors
Matt Corallo [Tue, 10 Jan 2023 17:23:31 +0000 (17:23 +0000)]
Merge pull request #1943 from andrei-21/feature/handle-read-dir-errors

Handle `read_dir()` errors in persister

15 months agoMake `debug_sync` regex more robust 2022-01-lockorder-windows-robust
Matt Corallo [Tue, 10 Jan 2023 06:37:39 +0000 (06:37 +0000)]
Make `debug_sync` regex more robust

On windows the symbol names appear to sometimes be truncated,
which causes the symbol name to not include the `::new` at the end.
This causes the regex to mis-match and track the wrong location
for the mutex construction, leading to bogus lockorder violations.

For example, in testing the following symbol name appeared on
Windows, without the function name itself:

`lightning::debug_sync::RwLock<std::collections::hash::map::HashMap<lightning::chain::transaction::OutPoint,lightning::chain::chainmonitor::MonitorHolder<lightning::util::enforcing_trait_impls::EnforcingSigner>,std::collections::hash::map::RandomState> >::`

15 months agoMove tests from debug_sync to a new submodule
Matt Corallo [Tue, 10 Jan 2023 06:34:30 +0000 (06:34 +0000)]
Move tests from debug_sync to a new submodule

This will allow us to change the module regex match in debug_sync
to make it more robust.

15 months agoMove `debug_sync` to the new `sync` folder
Matt Corallo [Tue, 10 Jan 2023 06:29:58 +0000 (06:29 +0000)]
Move `debug_sync` to the new `sync` folder

15 months agoMove `no-std` sync implementations to a folder to clean up
Matt Corallo [Tue, 10 Jan 2023 06:26:46 +0000 (06:26 +0000)]
Move `no-std` sync implementations to a folder to clean up

15 months agoHandle read_dir() errors in persister
Andrei [Tue, 10 Jan 2023 00:00:00 +0000 (00:00 +0000)]
Handle read_dir() errors in persister

15 months agoRemove the `ChannelManager::channel_state`
Viktor Tigerström [Fri, 6 Jan 2023 23:31:10 +0000 (00:31 +0100)]
Remove the `ChannelManager::channel_state`

15 months agoExpect `pending_msg_events` to be in random peer order in tests
Viktor Tigerström [Tue, 3 Jan 2023 09:52:10 +0000 (10:52 +0100)]
Expect `pending_msg_events` to be in random peer order in tests

15 months agoStore `pending_msg_events` per peer
Viktor Tigerström [Mon, 19 Dec 2022 19:51:07 +0000 (20:51 +0100)]
Store `pending_msg_events` per peer

15 months agoUse correct node in `test_invalid_upfront_shutdown_script`
Viktor Tigerström [Tue, 3 Jan 2023 09:52:41 +0000 (10:52 +0100)]
Use correct node in `test_invalid_upfront_shutdown_script`

15 months agoAvoid unnecessary looping over all peers' channels
Viktor Tigerström [Sat, 10 Dec 2022 22:02:00 +0000 (23:02 +0100)]
Avoid unnecessary looping over all peers' channels

15 months agoUpdate `id_to_peer` docs with consistency guarantees info
Viktor Tigerström [Sat, 10 Dec 2022 21:20:05 +0000 (22:20 +0100)]
Update `id_to_peer` docs with consistency guarantees info

15 months agoRemove one tab level when accessing a `peer_state`
Viktor Tigerström [Sat, 10 Dec 2022 17:54:01 +0000 (18:54 +0100)]
Remove one tab level when accessing a `peer_state`

15 months agoRemove unnecessary channel counterparty checks
Viktor Tigerström [Sat, 10 Dec 2022 17:03:22 +0000 (18:03 +0100)]
Remove unnecessary channel counterparty checks

15 months agoAdd handle unkown peer test
Viktor Tigerström [Mon, 13 Jun 2022 19:24:51 +0000 (21:24 +0200)]
Add handle unkown peer test