Skip to content

Commit fac5373

Browse files
authored
Merge pull request #2068 from jkczyz/2023-03-doc-fixes
Doc and build warning fixes
2 parents 852cf2b + 1d1323a commit fac5373

File tree

10 files changed

+30
-16
lines changed

10 files changed

+30
-16
lines changed

fuzz/src/full_stack.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use lightning::ln::msgs::{self, DecodeError};
4242
use lightning::ln::script::ShutdownScript;
4343
use lightning::routing::gossip::{P2PGossipSync, NetworkGraph};
4444
use lightning::routing::utxo::UtxoLookup;
45-
use lightning::routing::router::{find_route, InFlightHtlcs, PaymentParameters, Route, RouteHop, RouteParameters, Router};
45+
use lightning::routing::router::{find_route, InFlightHtlcs, PaymentParameters, Route, RouteParameters, Router};
4646
use lightning::routing::scoring::FixedPenaltyScorer;
4747
use lightning::util::config::UserConfig;
4848
use lightning::util::errors::APIError;

lightning-background-processor/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ use lightning::routing::gossip::{NetworkGraph, P2PGossipSync};
3333
use lightning::routing::utxo::UtxoLookup;
3434
use lightning::routing::router::Router;
3535
use lightning::routing::scoring::{Score, WriteableScore};
36-
use lightning::util::events::{Event, EventHandler, EventsProvider, PathFailure};
36+
use lightning::util::events::{Event, PathFailure};
37+
#[cfg(feature = "std")]
38+
use lightning::util::events::{EventHandler, EventsProvider};
3739
use lightning::util::logger::Logger;
3840
use lightning::util::persist::Persister;
3941
use lightning_rapid_gossip_sync::RapidGossipSync;

lightning-block-sync/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ impl BlockSourceError {
132132
}
133133

134134
/// Converts the error into the underlying error.
135+
///
136+
/// May contain an [`std::io::Error`] from the [`BlockSource`]. See implementations for further
137+
/// details, if any.
135138
pub fn into_inner(self) -> Box<dyn std::error::Error + Send + Sync> {
136139
self.error
137140
}

lightning-block-sync/src/rpc.rs

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ impl fmt::Display for RpcError {
3535
impl Error for RpcError {}
3636

3737
/// A simple RPC client for calling methods using HTTP `POST`.
38+
///
39+
/// Implements [`BlockSource`] and may return an `Err` containing [`RpcError`]. See
40+
/// [`RpcClient::call_method`] for details.
3841
pub struct RpcClient {
3942
basic_auth: String,
4043
endpoint: HttpEndpoint,
@@ -57,6 +60,9 @@ impl RpcClient {
5760
}
5861

5962
/// Calls a method with the response encoded in JSON format and interpreted as type `T`.
63+
///
64+
/// When an `Err` is returned, [`std::io::Error::into_inner`] may contain an [`RpcError`] if
65+
/// [`std::io::Error::kind`] is [`std::io::ErrorKind::Other`].
6066
pub async fn call_method<T>(&self, method: &str, params: &[serde_json::Value]) -> std::io::Result<T>
6167
where JsonResponse: TryFrom<Vec<u8>, Error = std::io::Error> + TryInto<T, Error = std::io::Error> {
6268
let host = format!("{}:{}", self.endpoint.host(), self.endpoint.port());

lightning-rapid-gossip-sync/src/processing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<NG: Deref<Target=NetworkGraph<L>>, L: Deref> RapidGossipSync<NG, L> where L
4242
&self,
4343
read_cursor: &mut R,
4444
) -> Result<u32, GraphSyncError> {
45-
#[allow(unused_mut)]
45+
#[allow(unused_mut, unused_assignments)]
4646
let mut current_time_unix = None;
4747
#[cfg(all(feature = "std", not(test)))]
4848
{

lightning/src/ln/channelmanager.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313
//! responsible for tracking which channels are open, HTLCs are in flight and reestablishing those
1414
//! upon reconnect to the relevant peer(s).
1515
//!
16-
//! It does not manage routing logic (see [`find_route`] for that) nor does it manage constructing
16+
//! It does not manage routing logic (see [`Router`] for that) nor does it manage constructing
1717
//! on-chain transactions (it only monitors the chain to watch for any force-closes that might
1818
//! imply it needs to fail HTLCs/payments/channels it manages).
19-
//!
20-
//! [`find_route`]: crate::routing::router::find_route
2119
2220
use bitcoin::blockdata::block::BlockHeader;
2321
use bitcoin::blockdata::transaction::Transaction;
@@ -1775,14 +1773,12 @@ where
17751773
self.list_channels_with_filter(|_| true)
17761774
}
17771775

1778-
/// Gets the list of usable channels, in random order. Useful as an argument to [`find_route`]
1779-
/// to ensure non-announced channels are used.
1776+
/// Gets the list of usable channels, in random order. Useful as an argument to
1777+
/// [`Router::find_route`] to ensure non-announced channels are used.
17801778
///
17811779
/// These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
17821780
/// documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
17831781
/// are.
1784-
///
1785-
/// [`find_route`]: crate::routing::router::find_route
17861782
pub fn list_usable_channels(&self) -> Vec<ChannelDetails> {
17871783
// Note we use is_live here instead of usable which leads to somewhat confused
17881784
// internal/external nomenclature, but that's ok cause that's probably what the user
@@ -4016,7 +4012,7 @@ where
40164012
None => None
40174013
};
40184014

4019-
let mut peer_state_opt = counterparty_node_id_opt.as_ref().map(
4015+
let peer_state_opt = counterparty_node_id_opt.as_ref().map(
40204016
|counterparty_node_id| per_peer_state.get(counterparty_node_id).map(
40214017
|peer_mutex| peer_mutex.lock().unwrap()
40224018
)

lightning/src/ln/outbound_payment.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,11 @@ pub(crate) struct PaymentAttemptsUsingTime<T: Time> {
276276
/// it means the result of the first attempt is not known yet.
277277
pub(crate) count: usize,
278278
/// This field is only used when retry is `Retry::Timeout` which is only build with feature std
279-
first_attempted_at: T
279+
#[cfg(not(feature = "no-std"))]
280+
first_attempted_at: T,
281+
#[cfg(feature = "no-std")]
282+
phantom: core::marker::PhantomData<T>,
283+
280284
}
281285

282286
#[cfg(not(any(feature = "no-std", test)))]
@@ -290,7 +294,10 @@ impl<T: Time> PaymentAttemptsUsingTime<T> {
290294
pub(crate) fn new() -> Self {
291295
PaymentAttemptsUsingTime {
292296
count: 0,
293-
first_attempted_at: T::now()
297+
#[cfg(not(feature = "no-std"))]
298+
first_attempted_at: T::now(),
299+
#[cfg(feature = "no-std")]
300+
phantom: core::marker::PhantomData,
294301
}
295302
}
296303
}

lightning/src/sync/debug_sync.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl LockMetadata {
129129
// For each lock which is currently locked, check that no lock's locked-before
130130
// set includes the lock we're about to lock, which would imply a lockorder
131131
// inversion.
132-
for (locked_idx, locked) in held.borrow().iter() {
132+
for (locked_idx, _locked) in held.borrow().iter() {
133133
if *locked_idx == this.lock_idx {
134134
// Note that with `feature = "backtrace"` set, we may be looking at different
135135
// instances of the same lock. Still, doing so is quite risky, a total order
@@ -143,7 +143,7 @@ impl LockMetadata {
143143
panic!("Tried to acquire a lock while it was held!");
144144
}
145145
}
146-
for (locked_idx, locked) in held.borrow().iter() {
146+
for (_locked_idx, locked) in held.borrow().iter() {
147147
for (locked_dep_idx, _locked_dep) in locked.locked_before.lock().unwrap().iter() {
148148
if *locked_dep_idx == this.lock_idx && *locked_dep_idx != locked.lock_idx {
149149
#[cfg(feature = "backtrace")]

lightning/src/sync/fairrwlock.rs

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ impl<T> FairRwLock<T> {
4545
self.lock.read()
4646
}
4747

48+
#[allow(dead_code)]
4849
pub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<'_, T>> {
4950
self.lock.try_write()
5051
}

lightning/src/sync/test_lockorder_checks.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use crate::sync::debug_sync::{RwLock, Mutex};
33
use super::{LockHeldState, LockTestExt};
44

55
use std::sync::Arc;
6-
use std::thread;
76

87
#[test]
98
#[should_panic]

0 commit comments

Comments
 (0)