File tree 4 files changed +19
-2
lines changed
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 {
1501
1501
/// broadcast to most peers).
1502
1502
/// These events are handled by PeerManager::process_events if you are using a PeerManager.
1503
1503
#[ derive( Clone , Debug ) ]
1504
+ #[ cfg_attr( test, derive( PartialEq ) ) ]
1504
1505
pub enum MessageSendEvent {
1505
1506
/// Used to indicate that we've accepted a channel open and should send the accept_channel
1506
1507
/// message provided to the given peer.
Original file line number Diff line number Diff line change @@ -7512,6 +7512,16 @@ where
7512
7512
msg,
7513
7513
});
7514
7514
}
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
+ });
7515
7525
}
7516
7526
}
7517
7527
return;
Original file line number Diff line number Diff line change @@ -1144,7 +1144,7 @@ enum EncodingType {
1144
1144
}
1145
1145
1146
1146
/// Used to put an error message in a [`LightningError`].
1147
- #[ derive( Clone , Debug ) ]
1147
+ #[ derive( Clone , Debug , PartialEq ) ]
1148
1148
pub enum ErrorAction {
1149
1149
/// The peer took some action which made us think they were useless. Disconnect them.
1150
1150
DisconnectPeer {
Original file line number Diff line number Diff line change @@ -219,7 +219,13 @@ fn test_lnd_bug_6039() {
219
219
// see if LND will accept our protocol compliance.
220
220
let err_msg = msgs:: ErrorMessage { channel_id : chan. 2 , data : "link failed to shutdown" . to_string ( ) } ;
221
221
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 ! ( ) ; }
223
229
224
230
let node_1_shutdown = get_event_msg ! ( nodes[ 1 ] , MessageSendEvent :: SendShutdown , nodes[ 0 ] . node. get_our_node_id( ) ) ;
225
231
You can’t perform that action at this time.
0 commit comments