X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Ferrors.rs;h=94ad965667873aa0b8f66d2e06427a491547e611;hb=1d3861e5f6a543d882905ebda21656cc0ea231a7;hp=ddcc693b3398e969b364c89b4ee4a73684d33153;hpb=4a44bfa3a42841de88b7c52379892a358646d9b8;p=rust-lightning diff --git a/lightning/src/util/errors.rs b/lightning/src/util/errors.rs index ddcc693b..94ad9656 100644 --- a/lightning/src/util/errors.rs +++ b/lightning/src/util/errors.rs @@ -9,6 +9,8 @@ //! Error types live here. +use ln::script::ShutdownScript; + use alloc::string::String; use core::fmt; @@ -47,6 +49,18 @@ pub enum APIError { /// An attempt to call watch/update_channel returned an Err (ie you did this!), causing the /// attempted action to fail. MonitorUpdateFailed, + /// [`KeysInterface::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 + /// [`InitFeatures`]: crate::ln::features::InitFeatures + IncompatibleShutdownScript { + /// The incompatible shutdown script. + script: ShutdownScript, + }, } impl fmt::Debug for APIError { @@ -57,6 +71,9 @@ impl fmt::Debug for APIError { APIError::RouteError {ref err} => f.write_str(err), APIError::ChannelUnavailable {ref err} => f.write_str(err), APIError::MonitorUpdateFailed => f.write_str("Client indicated a channel monitor update failed"), + APIError::IncompatibleShutdownScript { ref script } => { + write!(f, "Provided a scriptpubkey format not accepted by peer: {}", script) + }, } } }