X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Foffers%2Finvoice_error.rs;h=5476ad551b7b627d5e1abac8d19fc836b673e54c;hb=dce514e91217bead52cbea551ccaee9c3a46581d;hp=f587b271d12d84e97031391044025f91df0dab65;hpb=0211daa48ba8233ad7dbf2864ca72e0150051c68;p=rust-lightning diff --git a/lightning/src/offers/invoice_error.rs b/lightning/src/offers/invoice_error.rs index f587b271..5476ad55 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_string(s: String) -> Self { + Self { + erroneous_field: None, + message: UntrustedString(s), + } + } +} + impl core::fmt::Display for InvoiceError { fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> { self.message.fmt(f)