@@ -971,9 +971,25 @@ impl<'a> HarnessNode<'a> {
971971 } ;
972972 // Use a different value of `use_old_mons` if we have another monitor
973973 // (only for node B) by shifting `use_old_mons` one in base-3.
974- use_old_mons /= 3 ;
974+ let mut monitor_bytes = serialized_mon. clone ( ) ;
975+ if use_old_mons % 3 == 2 {
976+ let keys_manager_0_2 = lightning_0_2:: sign:: KeysManager :: new ( & [ 0u8 ; 32 ] , 0 , 0 , false ) ;
977+ let read_res: Result < (
978+ bitcoin:: BlockHash ,
979+ lightning_0_2:: chain:: channelmonitor:: ChannelMonitor < lightning_0_2:: sign:: InMemorySigner >
980+ ) , _ > = lightning_0_2:: util:: ser:: ReadableArgs :: read (
981+ & mut & monitor_bytes[ ..] ,
982+ ( & keys_manager_0_2, & keys_manager_0_2)
983+ ) ;
984+
985+ if let Ok ( ( block_hash_0_2, old_monitor) ) = read_res {
986+ let mut reserialized = Vec :: new ( ) ;
987+ lightning_0_2:: util:: ser:: Writeable :: write ( & ( block_hash_0_2, & old_monitor) , & mut reserialized) . unwrap ( ) ;
988+ monitor_bytes = reserialized;
989+ }
990+ }
975991 let mon = <( BlockLocator , ChannelMonitor < TestChannelSigner > ) >:: read (
976- & mut & serialized_mon [ ..] ,
992+ & mut & monitor_bytes [ ..] ,
977993 ( & * self . keys_manager , & * self . keys_manager ) ,
978994 )
979995 . expect ( "Failed to read monitor" ) ;
0 commit comments