projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1894 from ssbright/2022-12-custom_payment_hash
[rust-lightning]
/
lightning
/
src
/
offers
/
parse.rs
diff --git
a/lightning/src/offers/parse.rs
b/lightning/src/offers/parse.rs
index 013970981767acb6f51062f9eefd9af445f71593..0b3dda7928593871f8007c5ff50d2d081366dac8 100644
(file)
--- a/
lightning/src/offers/parse.rs
+++ b/
lightning/src/offers/parse.rs
@@
-11,6
+11,7
@@
use bitcoin::bech32;
use bitcoin::bech32::{FromBase32, ToBase32};
use bitcoin::bech32;
use bitcoin::bech32::{FromBase32, ToBase32};
+use bitcoin::secp256k1;
use core::convert::TryFrom;
use core::fmt;
use crate::io;
use core::convert::TryFrom;
use core::fmt;
use crate::io;
@@
-115,23
+116,41
@@
pub enum ParseError {
Decode(DecodeError),
/// The parsed message has invalid semantics.
InvalidSemantics(SemanticError),
Decode(DecodeError),
/// The parsed message has invalid semantics.
InvalidSemantics(SemanticError),
+ /// The parsed message has an invalid signature.
+ InvalidSignature(secp256k1::Error),
}
/// Error when interpreting a TLV stream as a specific type.
#[derive(Debug, PartialEq)]
pub enum SemanticError {
}
/// Error when interpreting a TLV stream as a specific type.
#[derive(Debug, PartialEq)]
pub enum SemanticError {
+ /// 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.
+ UnsupportedChain,
/// An amount was expected but was missing.
MissingAmount,
/// The amount exceeded the total bitcoin supply.
InvalidAmount,
/// An amount was expected but was missing.
MissingAmount,
/// The amount exceeded the total bitcoin supply.
InvalidAmount,
+ /// An amount was provided but was not sufficient in value.
+ InsufficientAmount,
/// A currency was provided that is not supported.
UnsupportedCurrency,
/// A currency was provided that is not supported.
UnsupportedCurrency,
+ /// A feature was required but is unknown.
+ UnknownRequiredFeatures,
/// A required description was not provided.
MissingDescription,
/// A signing pubkey was not provided.
MissingSigningPubkey,
/// A required description was not provided.
MissingDescription,
/// A signing pubkey was not provided.
MissingSigningPubkey,
+ /// A quantity was expected but was missing.
+ MissingQuantity,
/// An unsupported quantity was provided.
InvalidQuantity,
/// An unsupported quantity was provided.
InvalidQuantity,
+ /// A quantity or quantity bounds was provided but was not expected.
+ UnexpectedQuantity,
+ /// Payer metadata was expected but was missing.
+ MissingPayerMetadata,
+ /// A payer id was expected but was missing.
+ MissingPayerId,
}
impl From<bech32::Error> for ParseError {
}
impl From<bech32::Error> for ParseError {
@@
-151,3
+170,9
@@
impl From<SemanticError> for ParseError {
Self::InvalidSemantics(error)
}
}
Self::InvalidSemantics(error)
}
}
+
+impl From<secp256k1::Error> for ParseError {
+ fn from(error: secp256k1::Error) -> Self {
+ Self::InvalidSignature(error)
+ }
+}