Commit graph

4486 commits

Author SHA1 Message Date
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
Matt Corallo
ac6e0b3fed
Merge pull request #1930 from arik-so/2022-12-remove-keysinterface
Remove KeysInterface
2023-01-14 04:59:27 +00: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
Viktor Tigerström
c42323c857 Remove unnecessary channel counterparty checks 2023-01-09 23:50:41 +01:00
Viktor Tigerström
5578d79bfa Add handle unkown peer test 2023-01-09 23:50:41 +01:00
Viktor Tigerström
8c175f5238 Add duplicate temporary_channel_id for 2 peers test 2023-01-09 23:50:41 +01:00
Viktor Tigerström
0eb74ec007 Unify failure to query Channel error messages 2023-01-09 23:50:41 +01:00
Viktor Tigerström
ff9840ea35 Avoid unnecessary immediate retake per_peer_state lock 2023-01-09 23:50:41 +01:00
Viktor Tigerström
b8ca7c9256 Remove unnecessary per_peer_state branch
After `channels` are now stored in the `per_peer_state`, some logic can
be simplified and extra accessing of the `per_peer_state` can be
removed.
2023-01-09 23:50:41 +01:00
Viktor Tigerström
1ab25a086a Store channels per peer 2023-01-09 23:50:41 +01:00
Matt Corallo
197a47a8f3
Merge pull request #1941 from andrei-21/feature/rework-unwrap
Rework `unwrap()` call in persistence
2023-01-09 19:35:57 +00:00
Omer Yacine
0acd5d3e46
Fix an incorrect assertion in tlv stream encoding
Types must be unique and monotonically increasing (using < instead of <=)
2023-01-09 21:20:23 +02:00
Omer Yacine
3a33693b1e
Expose impl_writeable_tlv_based macro
Every exported macro needed to have all the macros used inside it:
1- to be exported as well.
2- be called from the `$crate` namespace so it works in other crates.

Some structs in `lightning::util::ser` needed to be made public as they were used inside the exported macros.

Use the macros like this:
```Rust
lightning::impl_writeable_tlv_based!(...)
```
2023-01-09 21:16:30 +02:00
Matt Corallo
8896f6eb7f
Merge pull request #1940 from TheBlueMatt/2023-01-nostd-try-lock 2023-01-09 16:22:34 +00:00
Andrei
a320ebc100 Rework unwrap() call in persistence 2023-01-08 00:00:00 +00:00
Matt Corallo
efc0244ba6 Make the no-std RwLockGuard try_lock actually try
There doesn't appear to be any reason to have `try_lock` fail, and
future work shouldn't need to check for std to use `try_lock`.
2023-01-07 22:43:09 +00:00
Viktor Tigerström
4207eab59d Add try_write function to FairRwLock 2023-01-07 00:52:30 +01:00
Viktor Tigerström
48f9c72eb6 Add ChannelManager::PeerState::latest_features docs 2023-01-07 00:52:29 +01:00
Viktor Tigerström
ce5cc73b4d Add counterparty_node to test macros 2023-01-07 00:52:29 +01:00
valentinewallace
d8a20eda5f
Merge pull request #1927 from jkczyz/2022-12-invoice-rework
Pre-work for BOLT 12 invoices
2023-01-06 11:07:17 -05:00
Jeffrey Czyz
b50fc4e32c
Define blinded hop features for use in BOLT 12
BOLT 12 invoices may contain blinded_payinfo for each hop in a blinded
path. Each blinded_payinfo contains features, whose length must be
encoded since there may be multiple hops.

Note these features are also needed in the BOLT 4 encrypted_data_tlv
stream. But since they are a single TLV record, the length must *not* be
encoded there.
2023-01-05 22:39:24 -06:00
Jeffrey Czyz
d985ced7e3
Define BOLT 12 invoice features with MPP support 2023-01-05 22:39:24 -06:00
Jeffrey Czyz
ea1a68c6e6
Use explicit WithoutLength for BOLT 12 features
Most BOLT 12 features are used as the value of a TLV record and thus
don't use an explicit length. One exception is the features inside the
blinded payinfo subtype since the TLV record contains a list of them.
However, these features are also used in the BOLT 4 encrypted_data_tlv
TLV stream as a single record, where the length is implicit.

Implement Readable and Writeable for Features wrapped in WithoutLength
such that either serialization can be used where required.
2023-01-05 22:39:24 -06:00
Jeffrey Czyz
1a437f4150
Remove Option from InvoiceRequest::signature
Refunds don't have signatures and now use their own abstraction.
Therefore, signatures can be required in invoice requests as per the
spec.
2023-01-05 22:39:24 -06:00
Jeffrey Czyz
7964b9f745
Correct documentation about Refund::payer_id
The docs incorrectly stated that Refund::payer_id is for signing, where
it is only used for identifying a node if Refund::paths is not present.
2023-01-05 22:38:31 -06:00
Matt Corallo
b79ff71fe7
Merge pull request #1812 from valentinewallace/2022-10-chanman-router-param
Parameterize `ChannelManager` by a `Router`
2023-01-05 22:09:35 +00:00
Valentine Wallace
19516c041e
Test utils: allow queueing >2 persistence update results 2023-01-05 11:29:24 -05:00
Valentine Wallace
22501c3c5e
ser_macros: rename check_tlv_order
.. to disamgibutate from check_encoded_tlv_order
2023-01-05 11:29:24 -05:00
Matt Corallo
af6fa143a1
Provide a static_value TLV field serialization type
This is useful in the type serialization definition macros to avoid
writing or reading a field at all, simply using a static value on
each reload.
2023-01-05 11:29:21 -05:00
Valentine Wallace
682bb9b0ae
Parameterize Simple*ChannelManager with DefaultRouter and ProbScorer 2023-01-05 11:29:00 -05:00
Valentine Wallace
3a1982c741
Take in-flight HTLCs by reference in Router::find_route
Useful in upcoming work when for payment retries.
2023-01-05 11:24:56 -05:00