@@ -24,7 +24,7 @@ pub enum APIError {
2424 /// are documented, but generally indicates some precondition of a function was violated.
2525 APIMisuseError {
2626 /// A human-readable error message
27- err : String
27+ err : String ,
2828 } ,
2929 /// Due to a high feerate, we were unable to complete the request.
3030 /// For example, this may be returned if the feerate implies we cannot open a channel at the
@@ -33,20 +33,20 @@ pub enum APIError {
3333 /// A human-readable error message
3434 err : String ,
3535 /// The feerate which was too high.
36- feerate : u32
36+ feerate : u32 ,
3737 } ,
3838 /// A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
3939 /// too-many-hops, etc).
4040 InvalidRoute {
4141 /// A human-readable error message
42- err : String
42+ err : String ,
4343 } ,
4444 /// We were unable to complete the request as the Channel required to do so is unable to
4545 /// complete the request (or was not found). This can take many forms, including disconnected
4646 /// peer, channel at capacity, channel shutting down, etc.
4747 ChannelUnavailable {
4848 /// A human-readable error message
49- err : String
49+ err : String ,
5050 } ,
5151 /// An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`]
5252 /// returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a
@@ -74,11 +74,15 @@ pub enum APIError {
7474impl fmt:: Debug for APIError {
7575 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
7676 match * self {
77- APIError :: APIMisuseError { ref err} => write ! ( f, "Misuse error: {}" , err) ,
78- APIError :: FeeRateTooHigh { ref err, ref feerate} => write ! ( f, "{} feerate: {}" , err, feerate) ,
79- APIError :: InvalidRoute { ref err} => write ! ( f, "Invalid route provided: {}" , err) ,
80- APIError :: ChannelUnavailable { ref err} => write ! ( f, "Channel unavailable: {}" , err) ,
81- APIError :: MonitorUpdateInProgress => f. write_str ( "Client indicated a channel monitor update is in progress but not yet complete" ) ,
77+ APIError :: APIMisuseError { ref err } => write ! ( f, "Misuse error: {}" , err) ,
78+ APIError :: FeeRateTooHigh { ref err, ref feerate } => {
79+ write ! ( f, "{} feerate: {}" , err, feerate)
80+ } ,
81+ APIError :: InvalidRoute { ref err } => write ! ( f, "Invalid route provided: {}" , err) ,
82+ APIError :: ChannelUnavailable { ref err } => write ! ( f, "Channel unavailable: {}" , err) ,
83+ APIError :: MonitorUpdateInProgress => f. write_str (
84+ "Client indicated a channel monitor update is in progress but not yet complete" ,
85+ ) ,
8286 APIError :: IncompatibleShutdownScript { ref script } => {
8387 write ! ( f, "Provided a scriptpubkey format not accepted by peer: {}" , script)
8488 } ,
@@ -101,9 +105,9 @@ impl_writeable_tlv_based_enum_upgradable!(APIError,
101105#[ inline]
102106pub ( crate ) fn get_onion_debug_field ( error_code : u16 ) -> ( & ' static str , usize ) {
103107 match error_code & 0xff {
104- 4 | 5 | 6 => ( "sha256_of_onion" , 32 ) ,
105- 11 | 12 => ( "htlc_msat" , 8 ) ,
106- 13 | 18 => ( "cltv_expiry" , 4 ) ,
108+ 4 | 5 | 6 => ( "sha256_of_onion" , 32 ) ,
109+ 11 | 12 => ( "htlc_msat" , 8 ) ,
110+ 13 | 18 => ( "cltv_expiry" , 4 ) ,
107111 19 => ( "incoming_htlc_msat" , 8 ) ,
108112 20 => ( "flags" , 2 ) ,
109113 _ => ( "" , 0 ) ,
0 commit comments