Skip to content

Commit 7d84a45

Browse files
authored
Merge pull request #1934 from TheBlueMatt/2022-12-113-bindings-upstream
Trivial Bindings Updates
2 parents dc39799 + f00bc4d commit 7d84a45

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

lightning-invoice/src/payment.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1674,8 +1674,8 @@ mod tests {
16741674
) -> Result<Route, LightningError> {
16751675
// Simulate calling the Scorer just as you would in find_route
16761676
let route = Self::route_for_value(route_params.final_value_msat);
1677-
let mut locked_scorer = self.scorer.lock();
1678-
let scorer = ScorerAccountingForInFlightHtlcs::new(locked_scorer.deref_mut(), inflight_htlcs);
1677+
let locked_scorer = self.scorer.lock();
1678+
let scorer = ScorerAccountingForInFlightHtlcs::new(locked_scorer, inflight_htlcs);
16791679
for path in route.paths {
16801680
let mut aggregate_msat = 0u64;
16811681
for (idx, hop) in path.iter().rev().enumerate() {

lightning/src/onion_message/packet.rs

+3
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,16 @@ pub enum OnionMessageContents<T: CustomOnionMessageContents> {
118118

119119
impl<T: CustomOnionMessageContents> OnionMessageContents<T> {
120120
/// Returns the type that was used to decode the message payload.
121+
///
122+
/// (C-not exported) as methods on non-cloneable enums are not currently exportable
121123
pub fn tlv_type(&self) -> u64 {
122124
match self {
123125
&OnionMessageContents::Custom(ref msg) => msg.tlv_type(),
124126
}
125127
}
126128
}
127129

130+
/// (C-not exported) as methods on non-cloneable enums are not currently exportable
128131
impl<T: CustomOnionMessageContents> Writeable for OnionMessageContents<T> {
129132
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
130133
match self {

lightning/src/routing/router.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, S: Deref> Router for DefaultR
7171

7272
find_route(
7373
payer, params, &self.network_graph, first_hops, &*self.logger,
74-
&ScorerAccountingForInFlightHtlcs::new(&mut self.scorer.lock(), inflight_htlcs),
74+
&ScorerAccountingForInFlightHtlcs::new(self.scorer.lock(), inflight_htlcs),
7575
&random_seed_bytes
7676
)
7777
}
@@ -125,15 +125,15 @@ pub trait Router {
125125
/// [`find_route`].
126126
///
127127
/// [`Score`]: crate::routing::scoring::Score
128-
pub struct ScorerAccountingForInFlightHtlcs<'a, S: Score> {
129-
scorer: &'a mut S,
128+
pub struct ScorerAccountingForInFlightHtlcs<S: Score> {
129+
scorer: S,
130130
// Maps a channel's short channel id and its direction to the liquidity used up.
131131
inflight_htlcs: InFlightHtlcs,
132132
}
133133

134-
impl<'a, S: Score> ScorerAccountingForInFlightHtlcs<'a, S> {
134+
impl<S: Score> ScorerAccountingForInFlightHtlcs<S> {
135135
/// Initialize a new `ScorerAccountingForInFlightHtlcs`.
136-
pub fn new(scorer: &'a mut S, inflight_htlcs: InFlightHtlcs) -> Self {
136+
pub fn new(scorer: S, inflight_htlcs: InFlightHtlcs) -> Self {
137137
ScorerAccountingForInFlightHtlcs {
138138
scorer,
139139
inflight_htlcs
@@ -142,11 +142,11 @@ impl<'a, S: Score> ScorerAccountingForInFlightHtlcs<'a, S> {
142142
}
143143

144144
#[cfg(c_bindings)]
145-
impl<'a, S:Score> Writeable for ScorerAccountingForInFlightHtlcs<'a, S> {
145+
impl<S: Score> Writeable for ScorerAccountingForInFlightHtlcs<S> {
146146
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> { self.scorer.write(writer) }
147147
}
148148

149-
impl<'a, S: Score> Score for ScorerAccountingForInFlightHtlcs<'a, S> {
149+
impl<S: Score> Score for ScorerAccountingForInFlightHtlcs<S> {
150150
fn channel_penalty_msat(&self, short_channel_id: u64, source: &NodeId, target: &NodeId, usage: ChannelUsage) -> u64 {
151151
if let Some(used_liquidity) = self.inflight_htlcs.used_liquidity_msat(
152152
source, target, short_channel_id

0 commit comments

Comments
 (0)