X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Ferrors.rs;h=4ffde9a72d2cba94927e36373125d0d06fdb73d4;hb=2e33acbd9c5ebd605829859a982822df6e0f1723;hp=17e55a9799bb503c987782a2937c52a00634abdf;hpb=f4ab077a6938e5a2a28e33c25011cb80ce0a6611;p=rust-lightning diff --git a/lightning/src/util/errors.rs b/lightning/src/util/errors.rs index 17e55a97..4ffde9a7 100644 --- a/lightning/src/util/errors.rs +++ b/lightning/src/util/errors.rs @@ -37,7 +37,7 @@ pub enum APIError { /// too-many-hops, etc). InvalidRoute { /// A human-readable error message - err: &'static str + err: String }, /// We were unable to complete the request as the Channel required to do so is unable to /// complete the request (or was not found). This can take many forms, including disconnected @@ -55,13 +55,13 @@ pub enum APIError { /// [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel /// [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress MonitorUpdateInProgress, - /// [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible + /// [`SignerProvider::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible /// with the channel counterparty as negotiated in [`InitFeatures`]. /// /// Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open /// a channel or cooperatively close one with this peer (and will have to force-close instead). /// - /// [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey + /// [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey /// [`InitFeatures`]: crate::ln::features::InitFeatures IncompatibleShutdownScript { /// The incompatible shutdown script. @@ -84,6 +84,18 @@ impl fmt::Debug for APIError { } } +impl_writeable_tlv_based_enum_upgradable!(APIError, + (0, APIMisuseError) => { (0, err, required), }, + (2, FeeRateTooHigh) => { + (0, err, required), + (2, feerate, required), + }, + (4, InvalidRoute) => { (0, err, required), }, + (6, ChannelUnavailable) => { (0, err, required), }, + (8, MonitorUpdateInProgress) => {}, + (10, IncompatibleShutdownScript) => { (0, script, required), }, +); + #[inline] pub(crate) fn get_onion_debug_field(error_code: u16) -> (&'static str, usize) { match error_code & 0xff {