@@ -1772,20 +1772,48 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
17721772 // before they are handled.
17731773 if let wire:: Message :: StartBatch ( msg) = message {
17741774 if peer_lock. commitment_signed_batch . is_some ( ) {
1775- log_debug ! ( logger, "Peer {} sent start_batch for channel {} before previous batch completed" , log_pubkey!( their_node_id) , & msg. channel_id) ;
1776- return Err ( PeerHandleError { } . into ( ) ) ;
1775+ let error = format ! ( "Peer {} sent start_batch for channel {} before previous batch completed" , log_pubkey!( their_node_id) , & msg. channel_id) ;
1776+ log_debug ! ( logger, "{}" , error) ;
1777+ return Err ( LightningError {
1778+ err : error. clone ( ) ,
1779+ action : msgs:: ErrorAction :: DisconnectPeerWithWarning {
1780+ msg : msgs:: WarningMessage {
1781+ channel_id : msg. channel_id ,
1782+ data : error,
1783+ } ,
1784+ } ,
1785+ } . into ( ) ) ;
17771786 }
17781787
17791788 let batch_size = msg. batch_size as usize ;
17801789 if batch_size <= 1 {
1781- log_debug ! ( logger, "Peer {} sent start_batch for channel {} not strictly greater than 1" , log_pubkey!( their_node_id) , & msg. channel_id) ;
1782- return Err ( PeerHandleError { } . into ( ) ) ;
1790+ let error = format ! ( "Peer {} sent start_batch for channel {} not strictly greater than 1" , log_pubkey!( their_node_id) , & msg. channel_id) ;
1791+ log_debug ! ( logger, "{}" , error) ;
1792+ return Err ( LightningError {
1793+ err : error. clone ( ) ,
1794+ action : msgs:: ErrorAction :: SendWarningMessage {
1795+ msg : msgs:: WarningMessage {
1796+ channel_id : msg. channel_id ,
1797+ data : error,
1798+ } ,
1799+ log_level : Level :: Debug ,
1800+ } ,
1801+ } . into ( ) ) ;
17831802 }
17841803
17851804 const COMMITMENT_SIGNED_BATCH_LIMIT : usize = 20 ;
17861805 if batch_size > COMMITMENT_SIGNED_BATCH_LIMIT {
1787- log_debug ! ( logger, "Peer {} sent start_batch for channel {} exceeding the limit" , log_pubkey!( their_node_id) , & msg. channel_id) ;
1788- return Err ( PeerHandleError { } . into ( ) ) ;
1806+ let error = format ! ( "Peer {} sent start_batch for channel {} exceeding the limit" , log_pubkey!( their_node_id) , & msg. channel_id) ;
1807+ log_debug ! ( logger, "{}" , error) ;
1808+ return Err ( LightningError {
1809+ err : error. clone ( ) ,
1810+ action : msgs:: ErrorAction :: DisconnectPeerWithWarning {
1811+ msg : msgs:: WarningMessage {
1812+ channel_id : msg. channel_id ,
1813+ data : error,
1814+ } ,
1815+ } ,
1816+ } . into ( ) ) ;
17891817 }
17901818
17911819 peer_lock. commitment_signed_batch = Some ( ( msg. channel_id , batch_size, BTreeMap :: new ( ) ) ) ;
@@ -1796,8 +1824,17 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
17961824 if let wire:: Message :: CommitmentSigned ( msg) = message {
17971825 if let Some ( ( channel_id, batch_size, buffer) ) = & mut peer_lock. commitment_signed_batch {
17981826 if msg. channel_id != * channel_id {
1799- log_debug ! ( logger, "Peer {} sent batched commitment_signed for the wrong channel (expected: {}, actual: {})" , log_pubkey!( their_node_id) , channel_id, & msg. channel_id) ;
1800- return Err ( PeerHandleError { } . into ( ) ) ;
1827+ let error = format ! ( "Peer {} sent batched commitment_signed for the wrong channel (expected: {}, actual: {})" , log_pubkey!( their_node_id) , channel_id, & msg. channel_id) ;
1828+ log_debug ! ( logger, "{}" , error) ;
1829+ return Err ( LightningError {
1830+ err : error. clone ( ) ,
1831+ action : msgs:: ErrorAction :: DisconnectPeerWithWarning {
1832+ msg : msgs:: WarningMessage {
1833+ channel_id : msg. channel_id ,
1834+ data : error,
1835+ } ,
1836+ } ,
1837+ } . into ( ) ) ;
18011838 }
18021839
18031840 let funding_txid = match msg. funding_txid {
0 commit comments