Commit graph

93 commits

Author SHA1 Message Date
Matt Corallo
12687d75d5
Merge pull request #1660 from TheBlueMatt/2022-08-cleanup-ratelimits
Backfill gossip without buffering directly in LDK
2022-08-16 04:43:02 +00:00
Matt Corallo
7717fa23a8 Backfill gossip without buffering directly in LDK
Instead of backfilling gossip by buffering (up to) ten messages at
a time, only buffer one message at a time, as the peers' outbound
socket buffer drains. This moves the outbound backfill messages out
of `PeerHandler` and into the operating system buffer, where it
arguably belongs.

Not buffering causes us to walk the gossip B-Trees somewhat more
often, but avoids allocating vecs for the responses. While its
probably (without having benchmarked it) a net performance loss, it
simplifies buffer tracking and leaves us with more room to play
with the buffer sizing constants as we add onion message forwarding
which is an important win.

Note that because we change how often we check if we're out of
messages to send before pinging, we slightly change how many
messages are exchanged at once, impacting the
`test_do_attempt_write_data` constants.
2022-08-15 21:35:05 +00:00
Matt Corallo
b414c0641b
Merge pull request #1658 from lightning-signer/2022-08-bitcoin-0-29
Update bitcoin crate to 0.29.0
2022-08-12 23:51:06 +00:00
Devrandom
7e05623bef Update bitcoin crate to 0.29.0 2022-08-11 00:21:26 +02:00
Valentine Wallace
c242003dd3
Fix CI to error on doc links to private items
Somehow we weren't doing this.
2022-08-07 13:49:12 -04:00
Matt Corallo
e10dfe4fd0 Bump crate versions to 0.0.110/invoice 0.18 2022-07-26 22:01:09 +00:00
Max Fang
5019b31b28 lightning-net-tokio: Allow custom smart pointers 2022-07-19 21:57:12 -07:00
Matt Corallo
156cc77753 Bump crate versions to 0.0.109/invoice 0.17 2022-07-01 16:05:33 +00:00
Matt Corallo
deac430f17 Update crate versions to 0.0.108/invoice 0.16 2022-06-10 14:53:23 +00:00
Jeffrey Czyz
b2e635f619
Bump crate versions to 0.0.107/invoice 0.15 2022-06-08 18:16:48 -05:00
Elias Rohrer
e98f68aee6 Rename FundingLocked to ChannelReady. 2022-05-30 17:07:09 -07:00
Matt Corallo
b5a63070f5
Merge pull request #1023 from TheBlueMatt/2021-07-par-gossip-processing 2022-05-11 17:24:16 +00:00
Matt Corallo
b222be233b [net-tokio] Explicitly yield after processing messages from a peer
This reduces instances of disconnect peers after single timer
intervals somewhat, at least on Tokio 1.14.
2022-05-10 23:40:20 +00:00
Matt Corallo
f90983180e Wake reader future when we fail to flush socket buffer
This avoids any extra calls to `read_event` after a write fails to
flush the write buffer fully, as is required by the PeerManager
API (though it isn't critical).
2022-05-10 23:40:20 +00:00
Matt Corallo
b1550524cf [net-tokio] Call PeerManager::process_events without blocking reads
Unlike very ancient versions of lightning-net-tokio, this does not
rely on a single global process_events future, but instead has one
per connection. This could still cause significant contention, so
we'll ensure only two process_events calls can exist at once in
the next few commits.
2022-05-10 23:40:20 +00:00
Jeffrey Czyz
65920818db
Merge pull request #1389 from lightning-signer/2022-03-bitcoin
Update bitcoin crate to 0.28.1
2022-05-05 14:08:16 -05:00
Devrandom
28d33ff9e0 bitcoin crate 0.28.1 2022-05-05 18:04:42 +02:00
Matt Corallo
3f22d81a70 Add a test for socket connection races
Sadly this does not reproduce the issue fixed in the previous
commit.
2022-05-02 15:23:04 +00:00
Matt Corallo
fca67bcaa4 [lightning-net-tokio] Fix race-y unwrap fetching peer socket address
I recently saw the following panic on one of my test nodes:

```
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()`
    on an `Err` value: Os { code: 107, kind: NotConnected, message:
    "Transport endpoint is not connected" }',
    rust-lightning/lightning-net-tokio/src/lib.rs:250:38
```

Presumably what happened is somehow the connection was closed in
between us accepting it and us going to start processing it. While
this is a somewhat surprising race, its clearly reachable. The fix
proposed here is quite trivial - simply don't `unwrap` trying to
fetch our peer's socket address, instead treat the peer address as
`None` and discover the disconnection later when we go to read.
2022-04-24 21:04:54 +00:00
Jeffrey Czyz
de8bb8d261
Bump crate versions to 0.0.106/invoice 0.14 2022-04-03 08:05:08 -05:00
psycho-pirate
fc2f793d19 Argument added in lightning-net-tokio/src/lib.rs and comments updated 2022-03-23 04:44:28 +05:30
psycho-pirate
20a81e5c14 added network address in methods, filter_address function with tests and updated documentation 2022-03-23 04:44:28 +05:30
Matt Corallo
b1fb7fdb9b Rename RoutingMessageHandler::sync_routing_table peer_connected
Its somewhat strange to have a trait method which is named after
the intended action, rather than the action that occurred, leaving
it up to the implementor what action they want to take.
2022-03-17 22:04:48 +00:00
Matt Corallo
def0628332 Bump crate versions to 0.0.105/invoice 0.13 2022-03-01 00:43:24 +00:00
Jeffrey Czyz
62b1e01ad9
Generate docs with features for docs.rs
Enable generating docs using --all-features or --features="std" where
applicable. Additionally, use doc_auto_cfg to tag items requiring a
feature.

https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#doc_auto_cfg-automatically-generate-doccfg

This requires building with nightly, which is what is used by docs.rs.

https://docs.rs/about/builds

To test locally, use:

RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc ...
2022-02-18 15:38:31 -06:00
Matt Corallo
aca5b6934a Restrict tokio to 1.14 as a dev-dependency
This maintains our MSRV for simple `cargo test` runs, but doesn't
restrict users to any specific 1.X tokio version.
2022-02-17 17:47:13 +00:00
hackerrdave
d46c2a20e1 update repo name to use lightningdevkit 2021-12-26 22:53:16 -05:00
Matt Corallo
ec86e2a1a7 Bump versions to 0.0.104/invoice 0.12 2021-12-17 21:34:19 +00:00
Matt Corallo
2b837bb272 Bump crate versions to 0.0.103/invoice 0.11 2021-11-03 02:20:51 +00:00
Matt Corallo
f2e47e0db2 Bump crate versions to 0.0.102 and lightning-invoice 0.10 2021-10-18 18:32:36 +00:00
Matt Corallo
0dfb24e661 Move Persist trait to chainmonitor as that's the only reference 2021-10-14 00:16:50 +00:00
Matt Corallo
43fe3d55f1 Bump Crate versions to 0.0.101 (and invoice to 0.9) 2021-09-23 18:22:59 +00:00
Jeffrey Czyz
eff9a47075
Refactor PaymentFailureNetworkUpdate event
MessageSendEvent::PaymentFailureNetworkUpdate served as a hack to pass
an HTLCFailChannelUpdate from ChannelManager to NetGraphMsgHandler via
PeerManager. Instead, remove the event entirely and move the contained
data (renamed NetworkUpdate) to Event::PaymentFailed to be processed by
an event handler.
2021-09-15 11:50:27 -05:00
Jeffrey Czyz
a6e650630d
Pass Event by reference to EventHandler
Passing an Event by reference rather and by move gives more flexibility
for composing event handlers without needing to clone events.
2021-09-09 22:57:51 -05:00
Tibo-lg
2e5e40e0b2 Add custom message handler to peer manager 2021-08-25 13:22:09 +09:00
Matt Corallo
803d8041f1
Merge pull request #1048 from TheBlueMatt/2021-08-no-net-print
Remove explicit print in lightning-net-tokio, reduce redundant block connection logging
2021-08-18 00:31:28 +00:00
Matt Corallo
ecf1d656ef Stop printing to stderr in lightning-net-tokio for disconnections
It isn't exactly a critical error situation when we disconnect a
socket, so we shouldn't be printing to stderr, entirely bypassing
user logging, when it happens. We do still print to stderr if we
fail to write the first message to the socket, but this should
never happen unless the user has a reasonably-configured system
with at least one packet in bytes available for the socket buffer.
2021-08-17 21:03:14 +00:00
Matt Corallo
11f78798d3 Update versions to 0.0.100 and lightning-invoice to 0.8 2021-08-17 18:55:07 +00:00
Matt Corallo
3f229052ea Bump dependencies to bitcoin 0.27 and bech32 0.8 2021-07-31 18:29:07 +00:00
Matt Corallo
c9a8b26d58 Bump most crate versions to 0.0.99 and lightning-invoice to 0.7.0 2021-07-09 16:34:46 +00:00
Matt Corallo
656ed89388 No longer block disconnect_socket calls in lightning-net-tokio
See the previous commit for more information.
2021-06-23 00:51:31 +00:00
Matt Corallo
9c9081dfcb Bump versions to 0.0.98, lightning-invoice to 0.6.0 2021-06-08 21:08:29 +00:00
Jeffrey Czyz
a1f95de734
Remove event channel from lightning-net-tokio
It is unnecessary since ChannelManager has a notification interface as
of 12c735ab3a.
2021-05-25 00:28:59 -07:00
Jeffrey Czyz
7c465d69dc
Refactor EventsProvider to take an EventHandler 2021-05-24 14:16:16 -07:00
Matt Corallo
f551d5946b Bump versions to 0.0.14, lightning-invoice 0.5 2021-05-01 00:43:15 +00:00
Devrandom
ec35fe62a1 Remove Send and Sync from core crate 2021-04-29 21:07:28 +02:00
Matt Corallo
18a0967758 Enforce doc link correctness during cargo doc runs and in CI 2021-03-18 11:28:23 -04:00
Valentine Wallace
e8a0824dd4
Pass channel updates to ChannelManager and Channel.
This will be used to expose forwarding info for route hints in the next commit.

Co-authored-by: Valentine Wallace <vwallace@protonmail.com>
Co-authored-by: Antoine Riard <ariard@student.42.fr>
2021-03-17 17:36:26 -04:00
Matt Corallo
eeec6fac5c Update licenses and add missing fields in Cargo.toml files 2021-03-09 16:53:03 -05:00
Matt Corallo
d65d7e7257 Bump versions to 0.0.13 across the board
We also skip having different versions for different subcrates,
since that is confusing.
2021-03-09 14:11:11 -05:00