Drop `allow_wallclock_use` feature in favor of simply using `std`
authorMatt Corallo <git@bluematt.me>
Fri, 10 Dec 2021 05:57:30 +0000 (05:57 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 16 Dec 2021 18:33:24 +0000 (18:33 +0000)
Fixes #1147.

lightning-background-processor/Cargo.toml
lightning/Cargo.toml
lightning/src/ln/channelmanager.rs

index f5e90e1410d27ea226b1d67c82c48aab316a280a..531678325eb1643da225bf1272dc61568885b4cf 100644 (file)
@@ -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]
index 61ac0125fd29e1d7903d1a1dd687593ec6aa859e..b80e0a5b1b727e87470fc50c2bda21a5a79124b4 100644 (file)
@@ -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.
index 47d705fe625b4889d7d3da19681af0d4272b8807..1b0fa19e163a50811d6395e9ca138e2e47bffb8f 100644 (file)
@@ -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 {