@@ -1899,6 +1899,20 @@ impl ChannelManager {
1899
1899
Ok ( res)
1900
1900
}
1901
1901
1902
+ fn internal_update_fee ( & self , their_node_id : & PublicKey , msg : & msgs:: UpdateFee ) -> Result < ( ) , MsgHandleErrInternal > {
1903
+ let mut channel_state = self . channel_state . lock ( ) . unwrap ( ) ;
1904
+ match channel_state. by_id . get_mut ( & msg. channel_id ) {
1905
+ Some ( chan) => {
1906
+ if chan. get_their_node_id ( ) != * their_node_id {
1907
+ //TODO: here and below MsgHandleErrInternal, #153 case
1908
+ return Err ( MsgHandleErrInternal :: send_err_msg_no_close ( "Got a message for a channel from the wrong node!" , msg. channel_id ) ) ;
1909
+ }
1910
+ chan. update_fee ( & * self . fee_estimator , & msg) . map_err ( |e| MsgHandleErrInternal :: from_maybe_close ( e) )
1911
+ } ,
1912
+ None => return Err ( MsgHandleErrInternal :: send_err_msg_no_close ( "Failed to find corresponding channel" , msg. channel_id ) )
1913
+ }
1914
+ }
1915
+
1902
1916
fn internal_announcement_signatures ( & self , their_node_id : & PublicKey , msg : & msgs:: AnnouncementSignatures ) -> Result < ( ) , MsgHandleErrInternal > {
1903
1917
let ( chan_announcement, chan_update) = {
1904
1918
let mut channel_state = self . channel_state . lock ( ) . unwrap ( ) ;
@@ -2153,16 +2167,7 @@ impl ChannelMessageHandler for ChannelManager {
2153
2167
}
2154
2168
2155
2169
fn handle_update_fee ( & self , their_node_id : & PublicKey , msg : & msgs:: UpdateFee ) -> Result < ( ) , HandleError > {
2156
- let mut channel_state = self . channel_state . lock ( ) . unwrap ( ) ;
2157
- match channel_state. by_id . get_mut ( & msg. channel_id ) {
2158
- Some ( chan) => {
2159
- if chan. get_their_node_id ( ) != * their_node_id {
2160
- return Err ( HandleError { err : "Got a message for a channel from the wrong node!" , action : None } )
2161
- }
2162
- chan. update_fee ( & * self . fee_estimator , & msg)
2163
- } ,
2164
- None => return Err ( HandleError { err : "Failed to find corresponding channel" , action : None } )
2165
- }
2170
+ handle_error ! ( self , self . internal_update_fee( their_node_id, msg) , their_node_id)
2166
2171
}
2167
2172
2168
2173
fn handle_announcement_signatures ( & self , their_node_id : & PublicKey , msg : & msgs:: AnnouncementSignatures ) -> Result < ( ) , HandleError > {
0 commit comments