X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=lightning%2Fsrc%2Foffers%2Finvoice_error.rs;h=441dae265cbb4fb9c9ed8d527e6b9b65c1e61ad1;hb=debc20cc3e1bb8ce8625e67294d0c3036314fdcb;hp=f587b271d12d84e97031391044025f91df0dab65;hpb=32d6e91fd6547241a04dc7827e11efe0ed7e5f4f;p=rust-lightning diff --git a/lightning/src/offers/invoice_error.rs b/lightning/src/offers/invoice_error.rs index f587b271..441dae26 100644 --- a/lightning/src/offers/invoice_error.rs +++ b/lightning/src/offers/invoice_error.rs @@ -48,6 +48,16 @@ pub struct ErroneousField { pub suggested_value: Option>, } +impl InvoiceError { + /// Creates an [`InvoiceError`] with the given message. + pub fn from_str(s: &str) -> Self { + Self { + erroneous_field: None, + message: UntrustedString(s.to_string()), + } + } +} + impl core::fmt::Display for InvoiceError { fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> { self.message.fmt(f)