Commit graph

4514 commits

Author SHA1 Message Date
Matt Corallo
7a9bea1bdd 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.
2023-01-17 23:47:45 +00:00
Matt Corallo
358d980e64 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.
2023-01-17 23:47:45 +00:00
Matt Corallo
e1b58a810f
Merge pull request #1960 from tnull/2023-01-deref-router-in-invoicepayer
Make `InvoicePayer`'s `Router` `Deref`
2023-01-17 23:21:22 +00:00
Matt Corallo
31b0a13158
Merge pull request #1957 from TheBlueMatt/2022-01-mon-ref-lockorder
Pass MonitorUpdates by ref and tweak manager lockorder
2023-01-17 23:09:05 +00:00
Matt Corallo
01fe9badc0
Merge pull request #1955 from TheBlueMatt/2023-01-1950-message-text
Fix link text in `reply_short_channel_ids_end`
2023-01-17 17:49:29 +00:00
Matt Corallo
6742bd5244
Merge pull request #1963 from lexe-tech/max/derive-debug
derive `Debug` for `ConfirmationTarget`
2023-01-17 17:03:13 +00:00
Max Fang
ad4b91da88 derive Debug for ConfirmationTarget 2023-01-16 20:15:01 -08:00
Matt Corallo
437fa4f807
Merge pull request #1959 from danielgranhao/stop-passing-init-features-in-msg-handlers
Stop passing `InitFeatures` in msg handlers
2023-01-17 01:26:31 +00:00
Matt Corallo
7fefa00e09
Merge pull request #1939 from TheBlueMatt/2022-01-fuzz-hashbrown
Misc fuzzing tweaks
2023-01-17 00:55:37 +00:00
Elias Rohrer
bc8e1e51e9
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`.
2023-01-16 16:54:53 -06:00
Daniel Granhão
bcf174034a
Stop passing InitFeatures in msg handlers 2023-01-16 21:18:53 +00:00
Matt Corallo
bae81bafca Swap per_peer_state lock order 2023-01-15 23:53:21 +00:00
Matt Corallo
7e23afe1dc 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.
2023-01-15 23:53:21 +00:00
Matt Corallo
f9bafa6d0e 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.
2023-01-15 23:38:24 +00:00
Matt Corallo
fb5b427cba Make fuzz assertions explicit in Cargo.toml 2023-01-15 23:32:09 +00:00
Matt Corallo
11524884cb 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.
2023-01-15 23:32:08 +00:00
Matt Corallo
7bdbbca3b0 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.
2023-01-15 23:31:06 +00:00
Matt Corallo
3259996e50 Bump fuzz afl dependency to latest upstream version 2023-01-15 23:31:06 +00:00
Matt Corallo
8ecd71777c Fix link text in reply_short_channel_ids_end 2023-01-15 07:03:55 +00:00
Matt Corallo
ce6bcf68a1
Merge pull request #1950 from tnull/2023-01-fix-doc-warnings-and-nits
Fix doc warnings and doc cleanup in `msgs.rs`/`ser.rs`
2023-01-15 07:03:14 +00:00
Matt Corallo
de783e0b95
Merge pull request #1946 from wpaulino/init-features-user-config
Use UserConfig to determine advertised InitFeatures by ChannelManager
2023-01-15 04:00:11 +00:00
Matt Corallo
1e81287cbc
Merge pull request #1953 from arik-so/2023-01-debug-gossip-heisenbug 2023-01-14 22:43:26 +00:00
Arik Sosman
16deda07aa
Allow manually passing a timestamp to channel_failed. Fixes #1914. 2023-01-14 08:22:50 -08:00
Arik Sosman
e9d4ae1d3e
Add error messages to stale gossip cleanup assertions.
Should help debug #1914.
2023-01-14 07:27:44 -08:00
Wilmer Paulino
abf4e79dcd
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.
2023-01-13 23:54:51 -08:00
Matt Corallo
ac6e0b3fed
Merge pull request #1930 from arik-so/2022-12-remove-keysinterface
Remove KeysInterface
2023-01-14 04:59:27 +00:00
Elias Rohrer
defa2f6811
Fix misc. warnings from --document-private-items 2023-01-13 18:26:09 -06:00
Elias Rohrer
d325fa7831
Fix docs and export impl_tlv_based_enum variants 2023-01-13 18:03:28 -06:00
Elias Rohrer
d78d06ceba
Fix misc doc warnings. 2023-01-13 18:03:28 -06:00
Elias Rohrer
7eac897746
Fix doc warnings and cleanup in msgs.rs 2023-01-13 18:03:24 -06:00
Elias Rohrer
3bf2f7189c
Fix doc warnings and cleanup in ser.rs 2023-01-13 09:18:47 -06:00
Arik Sosman
49c1f30c8c
Decouple lifetimes for trait implementations that used to comprise KeysInterface. 2023-01-12 16:10:44 -08:00
Arik Sosman
72183bd932
Split up generic parameters that used to comprise KeysInterface. 2023-01-12 16:10:35 -08:00
Arik Sosman
5824e226ca
Remove KeysInterface trait. 2023-01-12 09:18:08 -08:00
Matt Corallo
e8b91a478b
Merge pull request #1823 from mariocynicys/expose-tlv-macros2
Expose `impl_writeable_tlv_based` macro
2023-01-11 21:02:25 +00:00
Matt Corallo
5221e4a861
Merge pull request #1507 from ViktorTigerstrom/2022-05-store-channels-per-peer
Store `channels` per-peer
2023-01-10 19:19:35 +00:00
Matt Corallo
fad52d8b98
Merge pull request #1944 from TheBlueMatt/2022-01-lockorder-windows-robust
Make `debug_sync` regex more robust
2023-01-10 19:19:25 +00:00
Matt Corallo
cd400782e3
Merge pull request #1943 from andrei-21/feature/handle-read-dir-errors
Handle `read_dir()` errors in persister
2023-01-10 17:23:31 +00:00
Matt Corallo
ab46f6b988 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:#️⃣:map::HashMap<lightning::chain::transaction::OutPoint,lightning::chain::chainmonitor::MonitorHolder<lightning::util::enforcing_trait_impls::EnforcingSigner>,std::collections:#️⃣:map::RandomState> >::`
2023-01-10 06:48:04 +00:00
Matt Corallo
230331f3e8 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.
2023-01-10 06:48:04 +00:00
Matt Corallo
558bfa3fb3 Move debug_sync to the new sync folder 2023-01-10 06:31:13 +00:00
Matt Corallo
f66f720fa5 Move no-std sync implementations to a folder to clean up 2023-01-10 06:26:46 +00:00
Andrei
7afa230806 Handle read_dir() errors in persister 2023-01-10 00:00:00 +00:00
Viktor Tigerström
23fdcca9a4 Remove the ChannelManager::channel_state 2023-01-09 23:50:41 +01:00
Viktor Tigerström
cb952f651f Expect pending_msg_events to be in random peer order in tests 2023-01-09 23:50:41 +01:00
Viktor Tigerström
6cb985390d Store pending_msg_events per peer 2023-01-09 23:50:41 +01:00
Viktor Tigerström
228fbc2f32 Use correct node in test_invalid_upfront_shutdown_script 2023-01-09 23:50:41 +01:00
Viktor Tigerström
1b70a1e973 Avoid unnecessary looping over all peers' channels 2023-01-09 23:50:41 +01:00
Viktor Tigerström
e2c5cb5b8c Update id_to_peer docs with consistency guarantees info 2023-01-09 23:50:41 +01:00
Viktor Tigerström
9e7c02cd12 Remove one tab level when accessing a peer_state 2023-01-09 23:50:41 +01:00