Skip to content

Commit 636125e

Browse files
committed
Bound Persister's WriteableScore by Deref
This makes the trait marginally more flexible, but more importantly matches our normal structure which makes the bindings generator a bit happier.
1 parent f89e963 commit 636125e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ where
764764
F::Target: 'static + FeeEstimator,
765765
L::Target: 'static + Logger,
766766
P::Target: 'static + Persist<<CM::Target as AChannelManager>::Signer>,
767-
PS::Target: 'static + Persister<'a, CM, L, SC>,
767+
PS::Target: 'static + Persister<'a, CM, L, S>,
768768
CM::Target: AChannelManager + Send + Sync,
769769
OM::Target: AOnionMessenger + Send + Sync,
770770
PM::Target: APeerManager + Send + Sync,
@@ -786,7 +786,7 @@ where
786786
if let Some(duration_since_epoch) = fetch_time() {
787787
if update_scorer(scorer, &event, duration_since_epoch) {
788788
log_trace!(logger, "Persisting scorer after update");
789-
if let Err(e) = persister.persist_scorer(&scorer) {
789+
if let Err(e) = persister.persist_scorer(&*scorer) {
790790
log_error!(logger, "Error: Failed to persist scorer, check your disk and permissions {}", e);
791791
// We opt not to abort early on persistence failure here as persisting
792792
// the scorer is non-critical and we still hope that it will have
@@ -935,7 +935,7 @@ impl BackgroundProcessor {
935935
F::Target: 'static + FeeEstimator,
936936
L::Target: 'static + Logger,
937937
P::Target: 'static + Persist<<CM::Target as AChannelManager>::Signer>,
938-
PS::Target: 'static + Persister<'a, CM, L, SC>,
938+
PS::Target: 'static + Persister<'a, CM, L, S>,
939939
CM::Target: AChannelManager + Send + Sync,
940940
OM::Target: AOnionMessenger + Send + Sync,
941941
PM::Target: APeerManager + Send + Sync,

lightning/src/util/persist.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,11 @@ pub trait KVStore {
157157
/// Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk.
158158
///
159159
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
160-
pub trait Persister<'a, CM: Deref, L: Deref, S: WriteableScore<'a>>
160+
pub trait Persister<'a, CM: Deref, L: Deref, S: Deref>
161161
where
162162
CM::Target: 'static + AChannelManager,
163163
L::Target: 'static + Logger,
164+
S::Target: WriteableScore<'a>,
164165
{
165166
/// Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
166167
///
@@ -175,10 +176,11 @@ where
175176
}
176177

177178

178-
impl<'a, A: KVStore + ?Sized, CM: Deref, L: Deref, S: WriteableScore<'a>> Persister<'a, CM, L, S> for A
179+
impl<'a, A: KVStore + ?Sized, CM: Deref, L: Deref, S: Deref> Persister<'a, CM, L, S> for A
179180
where
180181
CM::Target: 'static + AChannelManager,
181182
L::Target: 'static + Logger,
183+
S::Target: WriteableScore<'a>,
182184
{
183185
fn persist_manager(&self, channel_manager: &CM) -> Result<(), io::Error> {
184186
self.write(CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE,

0 commit comments

Comments
 (0)