@@ -870,8 +870,7 @@ enum ChanType {
870870}
871871
872872#[ inline]
873- pub fn do_test < Out : Output + MaybeSend + MaybeSync > ( data : & [ u8 ] , underlying_out : Out ) {
874- let out = SearchingOutput :: new ( underlying_out) ;
873+ pub fn do_test < Out : Output + MaybeSend + MaybeSync > ( data : & [ u8 ] , out : Out ) {
875874 let broadcast_a = Arc :: new ( TestBroadcaster { txn_broadcasted : RefCell :: new ( Vec :: new ( ) ) } ) ;
876875 let broadcast_b = Arc :: new ( TestBroadcaster { txn_broadcasted : RefCell :: new ( Vec :: new ( ) ) } ) ;
877876 let broadcast_c = Arc :: new ( TestBroadcaster { txn_broadcasted : RefCell :: new ( Vec :: new ( ) ) } ) ;
@@ -1859,11 +1858,7 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(data: &[u8], underlying_out:
18591858 // Can be generated as a result of calling `timer_tick_occurred` enough
18601859 // times while peers are disconnected
18611860 } ,
1862- _ => if out. may_fail. load( atomic:: Ordering :: Acquire ) {
1863- return ;
1864- } else {
1865- panic!( "Unhandled message event {:?}" , event)
1866- } ,
1861+ _ => panic!( "Unhandled message event {:?}" , event) ,
18671862 }
18681863 if $limit_events != ProcessMessages :: AllMessages {
18691864 break ;
@@ -1903,13 +1898,7 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(data: &[u8], underlying_out:
19031898 MessageSendEvent :: HandleError { ref action, .. } => {
19041899 assert_action_timeout_awaiting_response( action) ;
19051900 } ,
1906- _ => {
1907- if out. may_fail. load( atomic:: Ordering :: Acquire ) {
1908- return ;
1909- } else {
1910- panic!( "Unhandled message event" )
1911- }
1912- } ,
1901+ _ => panic!( "Unhandled message event" ) ,
19131902 }
19141903 }
19151904 push_excess_b_events!(
@@ -1931,13 +1920,7 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(data: &[u8], underlying_out:
19311920 MessageSendEvent :: HandleError { ref action, .. } => {
19321921 assert_action_timeout_awaiting_response( action) ;
19331922 } ,
1934- _ => {
1935- if out. may_fail. load( atomic:: Ordering :: Acquire ) {
1936- return ;
1937- } else {
1938- panic!( "Unhandled message event" )
1939- }
1940- } ,
1923+ _ => panic!( "Unhandled message event" ) ,
19411924 }
19421925 }
19431926 push_excess_b_events!(
@@ -2050,13 +2033,7 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(data: &[u8], underlying_out:
20502033 ..
20512034 } => { } ,
20522035
2053- _ => {
2054- if out. may_fail. load( atomic:: Ordering :: Acquire ) {
2055- return ;
2056- } else {
2057- panic!( "Unhandled event" )
2058- }
2059- } ,
2036+ _ => panic!( "Unhandled event" ) ,
20602037 }
20612038 }
20622039 while nodes[ $node] . needs_pending_htlc_processing( ) {
@@ -2879,28 +2856,6 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(data: &[u8], underlying_out:
28792856 }
28802857}
28812858
2882- /// We actually have different behavior based on if a certain log string has been seen, so we have
2883- /// to do a bit more tracking.
2884- #[ derive( Clone ) ]
2885- struct SearchingOutput < O : Output > {
2886- output : O ,
2887- may_fail : Arc < atomic:: AtomicBool > ,
2888- }
2889- impl < O : Output > Output for SearchingOutput < O > {
2890- fn locked_write ( & self , data : & [ u8 ] ) {
2891- // We hit a design limitation of LN state machine (see CONCURRENT_INBOUND_HTLC_FEE_BUFFER)
2892- if std:: str:: from_utf8 ( data) . unwrap ( ) . contains ( "Outbound update_fee HTLC buffer overflow - counterparty should force-close this channel" ) {
2893- self . may_fail . store ( true , atomic:: Ordering :: Release ) ;
2894- }
2895- self . output . locked_write ( data)
2896- }
2897- }
2898- impl < O : Output > SearchingOutput < O > {
2899- pub fn new ( output : O ) -> Self {
2900- Self { output, may_fail : Arc :: new ( atomic:: AtomicBool :: new ( false ) ) }
2901- }
2902- }
2903-
29042859pub fn chanmon_consistency_test < Out : Output + MaybeSend + MaybeSync > ( data : & [ u8 ] , out : Out ) {
29052860 do_test ( data, out) ;
29062861}
0 commit comments