Use Writeable for ChannelMonitor instead of a specific function.
[rust-lightning] / lightning-persister / src / lib.rs
index 2a6f7cf0e0e04fe0c3f85af1a381f8f24427d44c..ff8eeeb1f860427fb76e91f2692c7197d54e2525 100644 (file)
@@ -43,9 +43,9 @@ trait DiskWriteable {
        fn write(&self, writer: &mut fs::File) -> Result<(), Error>;
 }
 
-impl<ChanSigner: ChannelKeys + Writeable> DiskWriteable for ChannelMonitor<ChanSigner> {
+impl<ChanSigner: ChannelKeys> DiskWriteable for ChannelMonitor<ChanSigner> {
        fn write(&self, writer: &mut fs::File) -> Result<(), Error> {
-               self.write_for_disk(writer)
+               Writeable::write(self, writer)
        }
 }
 
@@ -94,7 +94,7 @@ impl FilesystemPersister {
        }
 
        #[cfg(test)]
-       fn load_channel_data<ChanSigner: ChannelKeys + Readable + Writeable>(&self) ->
+       fn load_channel_data<ChanSigner: ChannelKeys + Readable>(&self) ->
                Result<HashMap<OutPoint, ChannelMonitor<ChanSigner>>, ChannelMonitorUpdateErr> {
                if let Err(_) = fs::create_dir_all(&self.path_to_channel_data) {
                        return Err(ChannelMonitorUpdateErr::PermanentFailure);
@@ -128,7 +128,7 @@ impl FilesystemPersister {
        }
 }
 
-impl<ChanSigner: ChannelKeys + Readable + Writeable + Send + Sync> channelmonitor::Persist<ChanSigner> for FilesystemPersister {
+impl<ChanSigner: ChannelKeys + Readable + Send + Sync> channelmonitor::Persist<ChanSigner> for FilesystemPersister {
        fn persist_new_channel(&self, funding_txo: OutPoint, monitor: &ChannelMonitor<ChanSigner>) -> Result<(), ChannelMonitorUpdateErr> {
                self.write_channel_data(funding_txo, monitor)
                  .map_err(|_| ChannelMonitorUpdateErr::PermanentFailure)