Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ jobs:
# check if there is a conflict between no-std and the default std feature
cargo test --verbose --color always --features no-std
cd ..
cd lightning-invoice
cargo test --verbose --color always --no-default-features --features no-std
# check if there is a conflict between no-std and the default std feature
cargo test --verbose --color always --features no-std
cd ..
- name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
if: "matrix.build-no-std && matrix.coverage"
run: |
Expand Down
17 changes: 12 additions & 5 deletions lightning-invoice/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@ license = "MIT OR Apache-2.0"
keywords = [ "lightning", "bitcoin", "invoice", "BOLT11" ]
readme = "README.md"

[features]
default = ["std"]
no-std = ["hashbrown", "lightning/no-std", "core2/alloc"]
std = ["bitcoin_hashes/std", "num-traits/std", "lightning/std"]

[dependencies]
bech32 = "0.8"
lightning = { version = "0.0.104", path = "../lightning" }
secp256k1 = { version = "0.20", features = ["recovery"] }
num-traits = "0.2.8"
bitcoin_hashes = "0.10"
lightning = { version = "0.0.104", path = "../lightning", default-features = false }
secp256k1 = { version = "0.20", default-features = false, features = ["recovery", "alloc"] }
num-traits = { version = "0.2.8", default-features = false }
bitcoin_hashes = { version = "0.10", default-features = false }
hashbrown = { version = "0.11", optional = true }
core2 = { version = "0.3.0", default-features = false, optional = true }

[dev-dependencies]
lightning = { version = "0.0.104", path = "../lightning", default-features = false, features = ["_test_utils"] }
hex = "0.3"
lightning = { version = "0.0.104", path = "../lightning", features = ["_test_utils"] }
16 changes: 10 additions & 6 deletions lightning-invoice/src/de.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#[cfg(feature = "std")]
use std::error;
use std::fmt;
use std::fmt::{Display, Formatter};
use std::num::ParseIntError;
use std::str;
use std::str::FromStr;
use core::fmt;
use core::fmt::{Display, Formatter};
use core::num::ParseIntError;
use core::str;
use core::str::FromStr;

use bech32;
use bech32::{u5, FromBase32};

use bitcoin_hashes::Hash;
use bitcoin_hashes::sha256;
use crate::prelude::*;
use lightning::ln::PaymentSecret;
use lightning::routing::network_graph::RoutingFees;
use lightning::routing::router::{RouteHint, RouteHintHop};
Expand All @@ -28,7 +30,7 @@ use self::hrp_sm::parse_hrp;

/// State machine to parse the hrp
mod hrp_sm {
use std::ops::Range;
use core::ops::Range;

#[derive(PartialEq, Eq, Debug)]
enum States {
Expand Down Expand Up @@ -723,8 +725,10 @@ impl Display for ParseOrSemanticError {
}
}

#[cfg(feature = "std")]
impl error::Error for ParseError {}

#[cfg(feature = "std")]
impl error::Error for ParseOrSemanticError {}

macro_rules! from_error {
Expand Down
Loading