Skip to content

Commit 6a6ed2b

Browse files
committed
fix MultiThreadedLockableScore implemntation
1 parent f77aaee commit 6a6ed2b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lightning/src/routing/scoring.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,23 +227,28 @@ impl<'a, T: Score + 'a> Score for MultiThreadedScoreLock<'a, T> {
227227
#[cfg(c_bindings)]
228228
impl<'a, T: Score + 'a> Writeable for MultiThreadedScoreLock<'a, T> {
229229
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
230-
self.0.write(writer)
230+
self.write(writer)
231231
}
232232
}
233233

234234
#[cfg(c_bindings)]
235235
impl<'a, T: Score + 'a> LockableScore<'a> for MultiThreadedLockableScore<T> {
236-
type Locked = MultiThreadedScoreLock<'a, T>;
236+
type ScoreLocked = MultiThreadedScoreLock<'a, T>;
237+
type WriteLocked = MultiThreadedScoreLock<'a, T>;
237238

238-
fn lock(&'a self) -> MultiThreadedScoreLock<'a, T> {
239+
fn write_lock(&'a self) -> MultiThreadedScoreLock<'a, T> {
240+
MultiThreadedScoreLock(Mutex::lock(&self.score).unwrap())
241+
}
242+
243+
fn score_lock(&'a self) -> MultiThreadedScoreLock<'a, T> {
239244
MultiThreadedScoreLock(Mutex::lock(&self.score).unwrap())
240245
}
241246
}
242247

243248
#[cfg(c_bindings)]
244249
impl<T: Score> Writeable for MultiThreadedLockableScore<T> {
245250
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
246-
self.lock().write(writer)
251+
self.write_lock().write(writer)
247252
}
248253
}
249254

0 commit comments

Comments
 (0)