Skip to content

Commit 0b2524e

Browse files
committed
Remove futures feature
Now that we use core::future, the feature flag is no longer needed.
1 parent 361ff01 commit 0b2524e

File tree

6 files changed

+11
-26
lines changed

6 files changed

+11
-26
lines changed

.github/workflows/build.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ jobs:
122122
run: |
123123
cargo install cargo-llvm-cov
124124
export RUSTFLAGS="-Coverflow-checks=off"
125-
cargo llvm-cov --features rest-client,rpc-client,tokio,futures,serde --codecov --hide-instantiations --output-path=target/codecov.json
125+
cargo llvm-cov --features rest-client,rpc-client,tokio,serde --codecov --hide-instantiations --output-path=target/codecov.json
126126
# Could you use this to fake the coverage report for your PR? Sure.
127127
# Will anyone be impressed by your amazing coverage? No
128128
# Maybe if codecov wasn't broken we wouldn't need to do this...
@@ -232,13 +232,13 @@ jobs:
232232
- name: Run cargo check for release build.
233233
run: |
234234
cargo check --release
235-
cargo check --no-default-features --features=futures,std --release
235+
cargo check --no-default-features --features=std --release
236236
cargo doc --release
237237
- name: Run cargo check for Taproot build.
238238
run: |
239239
cargo check --release
240240
cargo check --no-default-features --release
241-
cargo check --no-default-features --features=futures,std --release
241+
cargo check --no-default-features --features=std --release
242242
cargo doc --release
243243
cargo doc --no-default-features --release
244244
env:

ci/ci-tests.sh

+2-5
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ cargo check -p lightning-block-sync --verbose --color always --features rpc-clie
6868
cargo test -p lightning-block-sync --verbose --color always --features rpc-client,rest-client,tokio
6969
cargo check -p lightning-block-sync --verbose --color always --features rpc-client,rest-client,tokio
7070

71-
echo -e "\n\nTest futures builds"
72-
cargo test -p lightning-background-processor --verbose --color always --features futures
73-
cargo test -p lightning-background-processor --verbose --color always --features futures --no-default-features
74-
7571
echo -e "\n\nTest Custom Message Macros"
7672
cargo test -p lightning-custom-message --verbose --color always
7773
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
@@ -85,6 +81,7 @@ for DIR in lightning-invoice lightning-rapid-gossip-sync lightning-liquidity; do
8581
done
8682

8783
cargo test -p lightning --verbose --color always --no-default-features
84+
cargo test -p lightning-background-processor --verbose --color always --no-default-features
8885

8986
echo -e "\n\nTesting c_bindings builds"
9087
# Note that because `$RUSTFLAGS` is not passed through to doctest builds we cannot selectively
@@ -98,7 +95,7 @@ done
9895

9996
# Note that because `$RUSTFLAGS` is not passed through to doctest builds we cannot selectively
10097
# disable doctests in `c_bindings` so we skip doctests entirely here.
101-
RUSTFLAGS="$RUSTFLAGS --cfg=c_bindings" cargo test -p lightning-background-processor --verbose --color always --features futures --no-default-features --lib --bins --tests
98+
RUSTFLAGS="$RUSTFLAGS --cfg=c_bindings" cargo test -p lightning-background-processor --verbose --color always --no-default-features --lib --bins --tests
10299
RUSTFLAGS="$RUSTFLAGS --cfg=c_bindings" cargo test -p lightning --verbose --color always --no-default-features --lib --bins --tests
103100

104101
echo -e "\n\nTesting other crate-specific builds"

lightning-background-processor/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ all-features = true
1414
rustdoc-args = ["--cfg", "docsrs"]
1515

1616
[features]
17-
futures = [ ]
1817
std = ["lightning/std", "lightning-liquidity/std", "bitcoin-io/std", "bitcoin_hashes/std"]
1918

2019
default = ["std"]

lightning-background-processor/src/lib.rs

+4-15
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#![deny(rustdoc::broken_intra_doc_links)]
55
#![deny(rustdoc::private_intra_doc_links)]
66
#![deny(missing_docs)]
7-
#![cfg_attr(not(feature = "futures"), deny(unsafe_code))]
87
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
98
#![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
109

@@ -25,7 +24,6 @@ use lightning::chain::chainmonitor::{ChainMonitor, Persist};
2524
use lightning::events::EventHandler;
2625
#[cfg(feature = "std")]
2726
use lightning::events::EventsProvider;
28-
#[cfg(feature = "futures")]
2927
use lightning::events::ReplayEvent;
3028
use lightning::events::{Event, PathFailure};
3129

@@ -36,14 +34,12 @@ use lightning::onion_message::messenger::AOnionMessenger;
3634
use lightning::routing::gossip::{NetworkGraph, P2PGossipSync};
3735
use lightning::routing::scoring::{ScoreUpdate, WriteableScore};
3836
use lightning::routing::utxo::UtxoLookup;
39-
#[cfg(feature = "futures")]
4037
use lightning::sign::ChangeDestinationSource;
4138
#[cfg(feature = "std")]
4239
use lightning::sign::ChangeDestinationSourceSync;
4340
use lightning::sign::OutputSpender;
4441
use lightning::util::logger::Logger;
4542
use lightning::util::persist::{KVStore, Persister};
46-
#[cfg(feature = "futures")]
4743
use lightning::util::sweep::OutputSweeper;
4844
#[cfg(feature = "std")]
4945
use lightning::util::sweep::OutputSweeperSync;
@@ -146,7 +142,6 @@ const SWEEPER_TIMER: u64 = 30;
146142
#[cfg(test)]
147143
const SWEEPER_TIMER: u64 = 1;
148144

149-
#[cfg(feature = "futures")]
150145
/// core::cmp::min is not currently const, so we define a trivial (and equivalent) replacement
151146
const fn min_u64(a: u64, b: u64) -> u64 {
152147
if a < b {
@@ -155,7 +150,6 @@ const fn min_u64(a: u64, b: u64) -> u64 {
155150
b
156151
}
157152
}
158-
#[cfg(feature = "futures")]
159153
const FASTEST_TIMER: u64 = min_u64(
160154
min_u64(FRESHNESS_TIMER, PING_TIMER),
161155
min_u64(SCORER_PERSIST_TIMER, min_u64(FIRST_NETWORK_PRUNE_TIMER, REBROADCAST_TIMER)),
@@ -508,7 +502,6 @@ macro_rules! define_run_body {
508502
} }
509503
}
510504

511-
#[cfg(feature = "futures")]
512505
pub(crate) mod futures_util {
513506
use core::future::Future;
514507
use core::marker::Unpin;
@@ -622,9 +615,7 @@ pub(crate) mod futures_util {
622615
unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &DUMMY_WAKER_VTABLE)) }
623616
}
624617
}
625-
#[cfg(feature = "futures")]
626618
use core::task;
627-
#[cfg(feature = "futures")]
628619
use futures_util::{dummy_waker, OptionalSelector, Selector, SelectorOutput};
629620

630621
/// Processes background events in a future.
@@ -634,8 +625,10 @@ use futures_util::{dummy_waker, OptionalSelector, Selector, SelectorOutput};
634625
/// future which outputs `true`, the loop will exit and this function's future will complete.
635626
/// The `sleeper` future is free to return early after it has triggered the exit condition.
636627
///
637-
/// See [`BackgroundProcessor::start`] for information on which actions this handles.
638-
///
628+
#[cfg_attr(
629+
feature = "std",
630+
doc = " See [`BackgroundProcessor::start`] for information on which actions this handles.\n"
631+
)]
639632
/// The `mobile_interruptable_platform` flag should be set if we're currently running on a
640633
/// mobile device, where we may need to check for interruption of the application regularly. If you
641634
/// are unsure, you should set the flag, as the performance impact of it is minimal unless there
@@ -775,7 +768,6 @@ use futures_util::{dummy_waker, OptionalSelector, Selector, SelectorOutput};
775768
#[cfg_attr(feature = "std", doc = " handle.await.unwrap()")]
776769
/// # }
777770
///```
778-
#[cfg(feature = "futures")]
779771
pub async fn process_events_async<
780772
'a,
781773
UL: 'static + Deref,
@@ -2096,7 +2088,6 @@ mod tests {
20962088
}
20972089

20982090
#[tokio::test]
2099-
#[cfg(feature = "futures")]
21002091
async fn test_channel_manager_persist_error_async() {
21012092
// Test that if we encounter an error during manager persistence, the thread panics.
21022093
let (_, nodes) = create_nodes(2, "test_persist_error_sync");
@@ -2605,7 +2596,6 @@ mod tests {
26052596
}
26062597

26072598
#[tokio::test]
2608-
#[cfg(feature = "futures")]
26092599
async fn test_not_pruning_network_graph_until_graph_sync_completion_async() {
26102600
let (sender, receiver) = std::sync::mpsc::sync_channel(1);
26112601

@@ -2808,7 +2798,6 @@ mod tests {
28082798
}
28092799

28102800
#[tokio::test]
2811-
#[cfg(feature = "futures")]
28122801
async fn test_payment_path_scoring_async() {
28132802
let (sender, mut receiver) = tokio::sync::mpsc::channel(1);
28142803
let event_handler = move |event: Event| {

msrv-no-dev-deps-check/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ lightning-block-sync = { path = "../lightning-block-sync", features = [ "rest-cl
99
lightning-invoice = { path = "../lightning-invoice" }
1010
lightning-net-tokio = { path = "../lightning-net-tokio" }
1111
lightning-persister = { path = "../lightning-persister" }
12-
lightning-background-processor = { path = "../lightning-background-processor", features = ["futures"] }
12+
lightning-background-processor = { path = "../lightning-background-processor" }
1313
lightning-rapid-gossip-sync = { path = "../lightning-rapid-gossip-sync" }
1414
lightning-custom-message = { path = "../lightning-custom-message" }

no-std-check/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ default = []
1010
lightning = { path = "../lightning", default-features = false }
1111
lightning-invoice = { path = "../lightning-invoice", default-features = false }
1212
lightning-rapid-gossip-sync = { path = "../lightning-rapid-gossip-sync", default-features = false }
13-
lightning-background-processor = { path = "../lightning-background-processor", features = ["futures"], default-features = false }
13+
lightning-background-processor = { path = "../lightning-background-processor", default-features = false }

0 commit comments

Comments
 (0)