@@ -5,14 +5,20 @@ extern crate bitcoin;
5
5
extern crate libc;
6
6
7
7
use bitcoin:: hashes:: hex:: ToHex ;
8
+ use crate :: utils:: DiskWriteable ;
9
+ use lightning:: chain;
10
+ use lightning:: chain:: chaininterface:: { BroadcasterInterface , FeeEstimator } ;
8
11
use lightning:: chain:: channelmonitor:: { ChannelMonitor , ChannelMonitorUpdate , ChannelMonitorUpdateErr } ;
9
12
use lightning:: chain:: channelmonitor;
10
- use lightning:: chain:: keysinterface:: ChannelKeys ;
13
+ use lightning:: chain:: keysinterface:: { ChannelKeys , KeysInterface } ;
11
14
use lightning:: chain:: transaction:: OutPoint ;
15
+ use lightning:: ln:: channelmanager;
16
+ use lightning:: ln:: channelmanager:: ChannelManager ;
17
+ use lightning:: util:: logger:: Logger ;
12
18
use lightning:: util:: ser:: { Writeable , Readable } ;
13
19
use std:: fs;
14
20
use std:: io:: Error ;
15
- use crate :: utils :: DiskWriteable ;
21
+ use std :: sync :: Arc ;
16
22
17
23
#[ cfg( test) ]
18
24
use {
@@ -44,6 +50,12 @@ impl<ChanSigner: ChannelKeys + Writeable> DiskWriteable for ChannelMonitor<ChanS
44
50
}
45
51
}
46
52
53
+ impl < ChanSigner : ChannelKeys + Writeable , M : chain:: Watch < Keys =ChanSigner > , T : BroadcasterInterface , K : KeysInterface < ChanKeySigner =ChanSigner > , F : FeeEstimator , L : Logger > DiskWriteable for Arc < ChannelManager < ChanSigner , Arc < M > , Arc < T > , Arc < K > , Arc < F > , Arc < L > > > {
54
+ fn write_to_file ( & self , writer : & mut fs:: File ) -> Result < ( ) , std:: io:: Error > {
55
+ self . write ( writer)
56
+ }
57
+ }
58
+
47
59
impl FilesystemPersister {
48
60
/// Initialize a new FilesystemPersister and set the path to the individual channels'
49
61
/// files.
@@ -102,6 +114,12 @@ impl<ChanSigner: ChannelKeys + Readable + Writeable + Send + Sync> channelmonito
102
114
}
103
115
}
104
116
117
+ impl < ChanSigner : ' static + ChannelKeys + Writeable , M : ' static + chain:: Watch < Keys =ChanSigner > , T : ' static + BroadcasterInterface , K : ' static + KeysInterface < ChanKeySigner =ChanSigner > , F : ' static + FeeEstimator , L : ' static + Logger > channelmanager:: Persist < ChanSigner , M , T , K , F , L > for FilesystemPersister {
118
+ fn persist_manager ( & self , data : Arc < ChannelManager < ChanSigner , Arc < M > , Arc < T > , Arc < K > , Arc < F > , Arc < L > > > ) -> Result < ( ) , std:: io:: Error > {
119
+ utils:: write_to_file ( self . path_to_channel_data . clone ( ) , "manager" . to_string ( ) , & data)
120
+ }
121
+ }
122
+
105
123
#[ cfg( test) ]
106
124
mod tests {
107
125
extern crate lightning;
0 commit comments