@@ -6,7 +6,7 @@ use chain::transaction::OutPoint;
66use chain:: keysinterface:: KeysInterface ;
77use ln:: channelmanager:: { ChannelManager , ChannelManagerReadArgs , RAACommitmentOrder , PaymentPreimage , PaymentHash } ;
88use ln:: channelmonitor:: { ChannelMonitor , ManyChannelMonitor } ;
9- use ln:: router:: { Route , Router } ;
9+ use ln:: router:: { Route , Router , RouterReadArgs } ;
1010use ln:: features:: InitFeatures ;
1111use ln:: msgs;
1212use ln:: msgs:: { ChannelMessageHandler , RoutingMessageHandler } ;
@@ -97,6 +97,16 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
9797 assert ! ( self . node. get_and_clear_pending_events( ) . is_empty( ) ) ;
9898 assert ! ( self . chan_monitor. added_monitors. lock( ) . unwrap( ) . is_empty( ) ) ;
9999
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+
100110 // Check that if we serialize and then deserialize all our channel monitors we get the
101111 // same set of outputs to watch for on chain as we have now. Note that if we write
102112 // tests that fully close channels and remove the monitors at some point this may break.
0 commit comments