File tree Expand file tree Collapse file tree 4 files changed +19
-2
lines changed Expand file tree Collapse file tree 4 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -1501,6 +1501,7 @@ impl MaybeReadable for Event {
15011501/// broadcast to most peers).
15021502/// These events are handled by PeerManager::process_events if you are using a PeerManager.
15031503#[ derive( Clone , Debug ) ]
1504+ #[ cfg_attr( test, derive( PartialEq ) ) ]
15041505pub enum MessageSendEvent {
15051506 /// Used to indicate that we've accepted a channel open and should send the accept_channel
15061507 /// message provided to the given peer.
Original file line number Diff line number Diff line change @@ -7512,6 +7512,16 @@ where
75127512 msg,
75137513 });
75147514 }
7515+ peer_state.pending_msg_events.push(events::MessageSendEvent::HandleError {
7516+ node_id: *counterparty_node_id,
7517+ action: msgs::ErrorAction::SendWarningMessage {
7518+ msg: msgs::WarningMessage {
7519+ channel_id: msg.channel_id,
7520+ data: "You appear to be exhibiting LND bug 6039, we'll keep sending you shutdown messages until you handle them correctly".to_owned()
7521+ },
7522+ log_level: Level::Trace,
7523+ }
7524+ });
75157525 }
75167526 }
75177527 return;
Original file line number Diff line number Diff line change @@ -1144,7 +1144,7 @@ enum EncodingType {
11441144}
11451145
11461146/// Used to put an error message in a [`LightningError`].
1147- #[ derive( Clone , Debug ) ]
1147+ #[ derive( Clone , Debug , PartialEq ) ]
11481148pub enum ErrorAction {
11491149 /// The peer took some action which made us think they were useless. Disconnect them.
11501150 DisconnectPeer {
Original file line number Diff line number Diff line change @@ -219,7 +219,13 @@ fn test_lnd_bug_6039() {
219219 // see if LND will accept our protocol compliance.
220220 let err_msg = msgs:: ErrorMessage { channel_id : chan. 2 , data : "link failed to shutdown" . to_string ( ) } ;
221221 nodes[ 0 ] . node . handle_error ( & nodes[ 1 ] . node . get_our_node_id ( ) , & err_msg) ;
222- let _node_0_repeated_shutdown = get_event_msg ! ( nodes[ 0 ] , MessageSendEvent :: SendShutdown , nodes[ 1 ] . node. get_our_node_id( ) ) ;
222+ let node_a_responses = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
223+ assert_eq ! ( node_a_responses[ 0 ] , MessageSendEvent :: SendShutdown {
224+ node_id: nodes[ 1 ] . node. get_our_node_id( ) ,
225+ msg: node_0_shutdown,
226+ } ) ;
227+ if let MessageSendEvent :: HandleError { action : msgs:: ErrorAction :: SendWarningMessage { .. } , .. }
228+ = node_a_responses[ 1 ] { } else { panic ! ( ) ; }
223229
224230 let node_1_shutdown = get_event_msg ! ( nodes[ 1 ] , MessageSendEvent :: SendShutdown , nodes[ 0 ] . node. get_our_node_id( ) ) ;
225231
You can’t perform that action at this time.
0 commit comments