From c575429639a388ef3d5fc2b036163914bc947c57 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 10 Dec 2021 05:57:30 +0000 Subject: [PATCH] Drop `allow_wallclock_use` feature in favor of simply using `std` Fixes #1147. --- lightning-background-processor/Cargo.toml | 2 +- lightning/Cargo.toml | 4 ---- lightning/src/ln/channelmanager.rs | 12 +++++++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lightning-background-processor/Cargo.toml b/lightning-background-processor/Cargo.toml index f5e90e141..531678325 100644 --- a/lightning-background-processor/Cargo.toml +++ b/lightning-background-processor/Cargo.toml @@ -11,7 +11,7 @@ edition = "2018" [dependencies] bitcoin = "0.27" -lightning = { version = "0.0.103", path = "../lightning", features = ["allow_wallclock_use"] } +lightning = { version = "0.0.103", path = "../lightning", features = ["std"] } lightning-persister = { version = "0.0.103", path = "../lightning-persister" } [dev-dependencies] diff --git a/lightning/Cargo.toml b/lightning/Cargo.toml index 61ac0125f..b80e0a5b1 100644 --- a/lightning/Cargo.toml +++ b/lightning/Cargo.toml @@ -11,7 +11,6 @@ Still missing tons of error-handling. See GitHub issues for suggested projects i """ [features] -allow_wallclock_use = [] fuzztarget = ["bitcoin/fuzztarget", "regex"] # Internal test utilities exposed to other repo crates _test_utils = ["hex", "regex", "bitcoin/bitcoinconsensus"] @@ -53,6 +52,3 @@ secp256k1 = { version = "0.20.2", default-features = false, features = ["alloc"] version = "0.27" default-features = false features = ["bitcoinconsensus", "secp-recovery"] - -[package.metadata.docs.rs] -features = ["allow_wallclock_use"] # When https://github.com/rust-lang/rust/issues/43781 complies with our MSVR, we can add nice banners in the docs for the methods behind this feature-gate. diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 47d705fe6..1b0fa19e1 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -67,10 +67,11 @@ use io::{Cursor, Read}; use sync::{Arc, Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard}; use core::sync::atomic::{AtomicUsize, Ordering}; use core::time::Duration; -#[cfg(any(test, feature = "allow_wallclock_use"))] -use std::time::Instant; use core::ops::Deref; +#[cfg(any(test, feature = "std"))] +use std::time::Instant; + // We hold various information about HTLC relay in the HTLC objects in Channel itself: // // Upon receipt of an HTLC from a peer, we'll give it a PendingHTLCStatus indicating if it should @@ -5110,8 +5111,9 @@ where /// indicating whether persistence is necessary. Only one listener on /// `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken /// up. - /// Note that the feature `allow_wallclock_use` must be enabled to use this function. - #[cfg(any(test, feature = "allow_wallclock_use"))] + /// + /// Note that this method is not available with the `no-std` feature. + #[cfg(any(test, feature = "std"))] pub fn await_persistable_update_timeout(&self, max_wait: Duration) -> bool { self.persistence_notifier.wait_timeout(max_wait) } @@ -5406,7 +5408,7 @@ impl PersistenceNotifier { } } - #[cfg(any(test, feature = "allow_wallclock_use"))] + #[cfg(any(test, feature = "std"))] fn wait_timeout(&self, max_wait: Duration) -> bool { let current_time = Instant::now(); loop { -- 2.39.5