# 1.41.0 is Debian stable
1.41.0,
# 1.45.2 is MSRV for lightning-net-tokio, lightning-block-sync, and coverage generation
- 1.45.2]
+ 1.45.2,
+ # 1.49.0 is MSRV for no_std builds using hashbrown
+ 1.49.0]
include:
- toolchain: stable
build-net-tokio: true
+ build-no-std: true
- toolchain: stable
platform: macos-latest
build-net-tokio: true
+ build-no-std: true
- toolchain: stable
platform: windows-latest
build-net-tokio: true
+ build-no-std: true
- toolchain: beta
build-net-tokio: true
+ build-no-std: true
+ - toolchain: 1.36.0
+ build-no-std: false
+ - toolchain: 1.41.0
+ build-no-std: false
- toolchain: 1.45.2
build-net-tokio: true
+ build-no-std: false
coverage: true
+ - toolchain: 1.49.0
+ build-no-std: true
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout source code
run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
- name: Build on Rust ${{ matrix.toolchain }}
if: "! matrix.build-net-tokio"
- run: cargo build --verbose --color always -p lightning && cargo build --verbose --color always -p lightning-invoice && cargo build --verbose --color always -p lightning-persister
+ run: |
+ cargo build --verbose --color always -p lightning
+ cargo build --verbose --color always -p lightning-invoice
+ cargo build --verbose --color always -p lightning-persister
- name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
if: "matrix.build-net-tokio && !matrix.coverage"
run: |
cargo build --verbose --color always --features rpc-client
cargo build --verbose --color always --features rpc-client,rest-client
cargo build --verbose --color always --features rpc-client,rest-client,tokio
- cd ..
- name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
if: matrix.coverage
run: |
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
- cd ..
- name: Test on Rust ${{ matrix.toolchain }} with net-tokio
if: "matrix.build-net-tokio && !matrix.coverage"
run: cargo test --verbose --color always
- name: Test on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
if: matrix.coverage
run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
+ - name: Test on no_std bullds Rust ${{ matrix.toolchain }}
+ if: "matrix.build-no-std && !matrix.coverage"
+ run: |
+ cd lightning
+ cargo test --verbose --color always --features hashbrown
+ cd ..
+ - name: Test on no_std bullds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
+ if: "matrix.build-no-std && matrix.coverage"
+ run: |
+ cd lightning
+ RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features hashbrown
+ cd ..
- name: Test on Rust ${{ matrix.toolchain }}
if: "! matrix.build-net-tokio"
- run: cargo test --verbose --color always -p lightning && cargo test --verbose --color always -p lightning-invoice && cargo build --verbose --color always -p lightning-persister
+ run: |
+ cargo test --verbose --color always -p lightning
+ cargo test --verbose --color always -p lightning-invoice
+ cargo build --verbose --color always -p lightning-persister
- name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
if: "matrix.build-net-tokio && !matrix.coverage"
run: |
cargo test --verbose --color always --features rpc-client
cargo test --verbose --color always --features rpc-client,rest-client
cargo test --verbose --color always --features rpc-client,rest-client,tokio
- cd ..
- name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
if: matrix.coverage
run: |
RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
- cd ..
- name: Install deps for kcov
if: matrix.coverage
run: |
run: |
cd lightning
RUSTFLAGS="--cfg=require_route_graph_test" cargo test
+ RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
cd ..
- name: Run benchmarks on Rust ${{ matrix.toolchain }}
run: |
cargo doc
cargo doc --document-private-items
cd fuzz && cargo check --features=stdin_fuzz
+cd ../lightning && cargo check --no-default-features --features=no_std
# This is unsafe to use in production because it may result in the counterparty publishing taking our funds.
unsafe_revoked_tx_signing = []
unstable = []
+no_std = ["hashbrown"]
[dependencies]
bitcoin = "0.26"
+hashbrown = { version = "0.11", optional = true }
hex = { version = "0.3", optional = true }
regex = { version = "0.1.80", optional = true }
use util::events::EventHandler;
use prelude::*;
-use std::collections::{HashMap, hash_map};
use std::sync::RwLock;
use core::ops::Deref;
use util::events::Event;
use prelude::*;
-use std::collections::{HashMap, HashSet};
use core::{cmp, mem};
use std::io::Error;
use core::ops::Deref;
use ln::msgs::UnsignedChannelAnnouncement;
use prelude::*;
-use std::collections::HashSet;
use core::sync::atomic::{AtomicUsize, Ordering};
use std::io::Error;
use ln::msgs::{DecodeError, MAX_VALUE_MSAT};
use prelude::*;
use alloc::collections::BTreeMap;
-use std::collections::HashMap;
use core::cmp;
use core::ops::Deref;
use core::mem::replace;
pub mod routing;
mod prelude {
- pub use alloc::{vec, vec::Vec, string::String};
-}
\ No newline at end of file
+ #[cfg(feature = "hashbrown")]
+ extern crate hashbrown;
+
+ pub use alloc::{vec, vec::Vec, string::String, collections::VecDeque};
+ #[cfg(not(feature = "hashbrown"))]
+ pub use std::collections::{HashMap, HashSet, hash_map};
+ #[cfg(feature = "hashbrown")]
+ pub use self::hashbrown::{HashMap, HashSet, hash_map};
+}
use util::test_utils;
use prelude::*;
-use std::collections::HashMap;
use std::sync::{Arc, Mutex};
// If persister_fail is true, we have the persister return a PermanentFailure
use prelude::*;
use core::{cmp, mem};
use core::cell::RefCell;
-use std::collections::{HashMap, hash_map, HashSet};
use std::io::{Cursor, Read};
use std::sync::{Arc, Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard};
use core::sync::atomic::{AtomicUsize, Ordering};
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use core::mem;
-use std::collections::HashMap;
pub const CHAN_CONFIRM_DEPTH: u32 = 10;
use prelude::*;
use alloc::collections::BTreeSet;
-use std::collections::{HashMap, HashSet};
use core::default::Default;
use std::sync::{Arc, Mutex};
use prelude::*;
use alloc::collections::LinkedList;
-use std::collections::{HashMap,hash_map,HashSet};
use std::sync::{Arc, Mutex};
use core::sync::atomic::{AtomicUsize, Ordering};
use core::{cmp, hash, fmt, mem};
use bitcoin::hash_types::BlockHash;
use prelude::*;
-use std::collections::HashMap;
use core::mem;
use ln::functional_test_utils::*;
use prelude::*;
use alloc::collections::BinaryHeap;
use core::cmp;
-use std::collections::HashMap;
use core::ops::Deref;
/// A hop in a route
}
}
+ #[cfg(not(feature = "no_std"))]
pub(super) fn random_init_seed() -> u64 {
// Because the default HashMap in std pulls OS randomness, we can use it as a (bad) RNG.
use core::hash::{BuildHasher, Hasher};
println!("Using seed of {}", seed);
seed
}
+ #[cfg(not(feature = "no_std"))]
use util::ser::Readable;
#[test]
+ #[cfg(not(feature = "no_std"))]
fn generate_routes() {
let mut d = match super::test_utils::get_route_file() {
Ok(f) => f,
}
#[test]
+ #[cfg(not(feature = "no_std"))]
fn generate_routes_mpp() {
let mut d = match super::test_utils::get_route_file() {
Ok(f) => f,
}
}
-#[cfg(test)]
+#[cfg(all(test, not(feature = "no_std")))]
pub(crate) mod test_utils {
use std::fs::File;
/// Tries to open a network graph file, or panics with a URL to fetch it.
}
}
-#[cfg(all(test, feature = "unstable"))]
+#[cfg(all(test, feature = "unstable", not(feature = "no_std")))]
mod benches {
use super::*;
use util::logger::{Logger, Record};
use prelude::*;
use std::io::{Read, Write};
-use std::collections::HashMap;
use core::hash::Hash;
use std::sync::Mutex;
use core::cmp;
use std::sync::{Mutex, Arc};
use core::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use core::{cmp, mem};
-use std::collections::{HashMap, HashSet, VecDeque};
use chain::keysinterface::InMemorySigner;
pub struct TestVecWriter(pub Vec<u8>);