X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Foffers%2Fparse.rs;h=c85c2f326b02a816dd85ba285334112ad557c324;hb=caafcedf3fc40fc6253261218c25b254dd955a82;hp=064604f3afb35bc9472ad8d1707b399102963cb3;hpb=5627d7cc1f94815915422e669e2f29a1a7854fc4;p=rust-lightning diff --git a/lightning/src/offers/parse.rs b/lightning/src/offers/parse.rs index 064604f3..c85c2f32 100644 --- a/lightning/src/offers/parse.rs +++ b/lightning/src/offers/parse.rs @@ -116,7 +116,7 @@ impl TryFrom> for ParsedMessage { } /// Error when parsing a bech32 encoded message using [`str::parse`]. -#[derive(Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq)] pub enum Bolt12ParseError { /// The bech32 encoding does not conform to the BOLT 12 requirements for continuing messages /// across multiple parts (i.e., '+' followed by whitespace). @@ -129,16 +129,14 @@ pub enum Bolt12ParseError { /// The bech32 decoded string could not be decoded as the expected message type. Decode(DecodeError), /// The parsed message has invalid semantics. - InvalidSemantics(SemanticError), + InvalidSemantics(Bolt12SemanticError), /// The parsed message has an invalid signature. InvalidSignature(secp256k1::Error), } /// Error when interpreting a TLV stream as a specific type. -/// -/// This is not exported to bindings users as its name conflicts with the BOLT 11 SemanticError type. -#[derive(Debug, PartialEq)] -pub enum SemanticError { +#[derive(Clone, Debug, PartialEq)] +pub enum Bolt12SemanticError { /// The current [`std::time::SystemTime`] is past the offer or invoice's expiration. AlreadyExpired, /// The provided chain hash does not correspond to a supported chain. @@ -181,6 +179,8 @@ pub enum SemanticError { MissingPayerMetadata, /// A payer id was expected but was missing. MissingPayerId, + /// The payment id for a refund or request is already in use. + DuplicatePaymentId, /// Blinded paths were expected but were missing. MissingPaths, /// The blinded payinfo given does not match the number of blinded path hops. @@ -205,8 +205,8 @@ impl From for Bolt12ParseError { } } -impl From for Bolt12ParseError { - fn from(error: SemanticError) -> Self { +impl From for Bolt12ParseError { + fn from(error: Bolt12SemanticError) -> Self { Self::InvalidSemantics(error) } }