@@ -6,7 +6,7 @@ use chain::transaction::OutPoint;
6
6
use chain:: keysinterface:: KeysInterface ;
7
7
use ln:: channelmanager:: { ChannelManager , ChannelManagerReadArgs , RAACommitmentOrder , PaymentPreimage , PaymentHash } ;
8
8
use ln:: channelmonitor:: { ChannelMonitor , ManyChannelMonitor } ;
9
- use ln:: router:: { Route , Router } ;
9
+ use ln:: router:: { Route , Router , RouterReadArgs } ;
10
10
use ln:: features:: InitFeatures ;
11
11
use ln:: msgs;
12
12
use ln:: msgs:: { ChannelMessageHandler , RoutingMessageHandler } ;
@@ -97,6 +97,16 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
97
97
assert ! ( self . node. get_and_clear_pending_events( ) . is_empty( ) ) ;
98
98
assert ! ( self . chan_monitor. added_monitors. lock( ) . unwrap( ) . is_empty( ) ) ;
99
99
100
+ // Check that if we serialize the Router, we can deserialize it again.
101
+ {
102
+ let mut w = test_utils:: TestVecWriter ( Vec :: new ( ) ) ;
103
+ self . router . write ( & mut w) . unwrap ( ) ;
104
+ let _ = Router :: read ( & mut :: std:: io:: Cursor :: new ( & w. 0 ) , RouterReadArgs {
105
+ chain_monitor : Arc :: clone ( & self . chain_monitor ) as Arc < chaininterface:: ChainWatchInterface > ,
106
+ logger : Arc :: clone ( & self . logger ) as Arc < Logger >
107
+ } ) . unwrap ( ) ;
108
+ }
109
+
100
110
// Check that if we serialize and then deserialize all our channel monitors we get the
101
111
// same set of outputs to watch for on chain as we have now. Note that if we write
102
112
// tests that fully close channels and remove the monitors at some point this may break.
0 commit comments