Skip to content

Commit d4d3225

Browse files
authored
Merge pull request #908 from TheBlueMatt/2021-04-invoice-real-bindings
Minor Tweaks to lightning-invoice for C bindings
2 parents e26c3df + 83ab933 commit d4d3225

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

lightning-invoice/src/de.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ use secp256k1;
2020
use secp256k1::recovery::{RecoveryId, RecoverableSignature};
2121
use secp256k1::key::PublicKey;
2222

23-
use super::*;
23+
use super::{Invoice, Sha256, TaggedField, ExpiryTime, MinFinalCltvExpiry, Fallback, PayeePubKey, InvoiceSignature, PositiveTimestamp,
24+
SemanticError, RouteHint, Description, RawTaggedField, Currency, RawHrp, SiPrefix, RawInvoice, constants, SignedRawInvoice,
25+
RawDataPart, CreationError, InvoiceFeatures};
2426

2527
use self::hrp_sm::parse_hrp;
2628

lightning-invoice/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ pub enum Currency {
332332
}
333333

334334
/// Tagged field which may have an unknown tag
335+
///
336+
/// (C-not exported) as we don't currently support TaggedField
335337
#[derive(Eq, PartialEq, Debug, Clone)]
336338
pub enum RawTaggedField {
337339
/// Parsed tagged field with known tag
@@ -343,6 +345,9 @@ pub enum RawTaggedField {
343345
/// Tagged field with known tag
344346
///
345347
/// For descriptions of the enum values please refer to the enclosed type's docs.
348+
///
349+
/// (C-not exported) As we don't yet support enum variants with the same name the struct contained
350+
/// in the variant.
346351
#[allow(missing_docs)]
347352
#[derive(Eq, PartialEq, Debug, Clone)]
348353
pub enum TaggedField {
@@ -1322,10 +1327,8 @@ impl std::error::Error for SemanticError { }
13221327

13231328
/// When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
13241329
/// may occur.
1325-
///
1326-
/// (C-not exported) As we don't support unbounded generics
13271330
#[derive(Eq, PartialEq, Debug, Clone)]
1328-
pub enum SignOrCreationError<S> {
1331+
pub enum SignOrCreationError<S = ()> {
13291332
/// An error occurred during signing
13301333
SignError(S),
13311334

lightning-invoice/src/ser.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ use std::fmt;
22
use std::fmt::{Display, Formatter};
33
use bech32::{ToBase32, u5, WriteBase32, Base32Len};
44

5-
use ::*;
5+
use super::{Invoice, Sha256, TaggedField, ExpiryTime, MinFinalCltvExpiry, Fallback, PayeePubKey, InvoiceSignature, PositiveTimestamp,
6+
RouteHint, Description, RawTaggedField, Currency, RawHrp, SiPrefix, constants, SignedRawInvoice, RawDataPart};
67

78
/// Converts a stream of bytes written to it to base32. On finalization the according padding will
89
/// be applied. That means the results of writing two data blocks with one or two `BytesToBase32`
@@ -122,6 +123,7 @@ impl Display for SignedRawInvoice {
122123
}
123124
}
124125

126+
/// (C-not exported)
125127
impl Display for RawHrp {
126128
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
127129
let amount = match self.raw_amount {

0 commit comments

Comments
 (0)