X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Fpersist.rs;h=3c8d93801ccdfec149601e4ec023b5514286f571;hb=e8b91a478bd2fd37fd726901271a8299847def3d;hp=40c042a27ff702c457a1c856db2097720cd4caf3;hpb=1c8a06cf61921b5edd637c066ca8bd001183042d;p=rust-lightning diff --git a/lightning/src/util/persist.rs b/lightning/src/util/persist.rs index 40c042a2..3c8d9380 100644 --- a/lightning/src/util/persist.rs +++ b/lightning/src/util/persist.rs @@ -10,10 +10,18 @@ use core::ops::Deref; use bitcoin::hashes::hex::ToHex; -use crate::io::{self}; +use crate::io; use crate::routing::scoring::WriteableScore; -use crate::{chain::{keysinterface::{Sign, KeysInterface}, self, transaction::{OutPoint}, chaininterface::{BroadcasterInterface, FeeEstimator}, chainmonitor::{Persist, MonitorUpdateId}, channelmonitor::{ChannelMonitor, ChannelMonitorUpdate}}, ln::channelmanager::ChannelManager, routing::gossip::NetworkGraph}; +use crate::chain; +use crate::chain::chaininterface::{BroadcasterInterface, FeeEstimator}; +use crate::chain::chainmonitor::{Persist, MonitorUpdateId}; +use crate::chain::keysinterface::{Sign, KeysInterface, SignerProvider}; +use crate::chain::transaction::OutPoint; +use crate::chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate}; +use crate::ln::channelmanager::ChannelManager; +use crate::routing::router::Router; +use crate::routing::gossip::NetworkGraph; use super::{logger::Logger, ser::Writeable}; /// Trait for a key-value store for persisting some writeable object at some key @@ -26,15 +34,16 @@ pub trait KVStorePersister { } /// Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk. -pub trait Persister<'a, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref, S: WriteableScore<'a>> - where M::Target: 'static + chain::Watch<::Signer>, +pub trait Persister<'a, M: Deref, T: Deref, K: Deref, F: Deref, R: Deref, L: Deref, S: WriteableScore<'a>> + where M::Target: 'static + chain::Watch<::Signer>, T::Target: 'static + BroadcasterInterface, K::Target: 'static + KeysInterface, F::Target: 'static + FeeEstimator, + R::Target: 'static + Router, L::Target: 'static + Logger, { /// Persist the given ['ChannelManager'] to disk, returning an error if persistence failed. - fn persist_manager(&self, channel_manager: &ChannelManager) -> Result<(), io::Error>; + fn persist_manager(&self, channel_manager: &ChannelManager) -> Result<(), io::Error>; /// Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed. fn persist_graph(&self, network_graph: &NetworkGraph) -> Result<(), io::Error>; @@ -43,15 +52,16 @@ pub trait Persister<'a, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref, S: Wri fn persist_scorer(&self, scorer: &S) -> Result<(), io::Error>; } -impl<'a, A: KVStorePersister, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref, S: WriteableScore<'a>> Persister<'a, M, T, K, F, L, S> for A - where M::Target: 'static + chain::Watch<::Signer>, +impl<'a, A: KVStorePersister, M: Deref, T: Deref, K: Deref, F: Deref, R: Deref, L: Deref, S: WriteableScore<'a>> Persister<'a, M, T, K, F, R, L, S> for A + where M::Target: 'static + chain::Watch<::Signer>, T::Target: 'static + BroadcasterInterface, K::Target: 'static + KeysInterface, F::Target: 'static + FeeEstimator, + R::Target: 'static + Router, L::Target: 'static + Logger, { /// Persist the given ['ChannelManager'] to disk with the name "manager", returning an error if persistence failed. - fn persist_manager(&self, channel_manager: &ChannelManager) -> Result<(), io::Error> { + fn persist_manager(&self, channel_manager: &ChannelManager) -> Result<(), io::Error> { self.persist("manager", channel_manager) }