#[cfg(feature = "std")]
use std::error;
+#[cfg(not(feature = "std"))]
use core::convert::TryFrom;
use core::fmt;
use core::fmt::{Display, Formatter};
use alloc::collections::{btree_map, BTreeMap};
use core::ops::Deref;
use core::time::Duration;
+#[cfg(not(feature = "std"))]
use core::iter::Iterator;
/// Utility to create an invoice that can be paid to one of multiple nodes, or a "phantom invoice."
#[allow(unused_imports)]
use crate::prelude::*;
-use core::convert::TryFrom;
-
/// An intermediate node, its outbound channel, and relay parameters.
#[derive(Clone, Debug)]
pub struct ForwardNode {
//! disconnections, transaction broadcasting, and feerate information requests.
use core::{cmp, ops::Deref};
-use core::convert::TryInto;
+
+use crate::prelude::*;
use bitcoin::blockdata::transaction::Transaction;
use core::{cmp, mem};
use crate::io::{self, Error};
-use core::convert::TryInto;
use core::ops::Deref;
use crate::sync::{Mutex, LockTestExt};
use crate::io;
use core::cmp;
-use core::convert::TryInto;
use core::mem;
use core::ops::Deref;
#[cfg(not(fuzzing))]
mod real_chacha {
use core::cmp;
- use core::convert::TryInto;
#[derive(Clone, Copy, PartialEq, Eq)]
#[allow(non_camel_case_types)]
#[cfg(test)]
mod test {
- use alloc::vec;
- use alloc::vec::{Vec};
- use core::convert::TryInto;
use core::iter::repeat;
+ use crate::prelude::*;
+
use super::ChaCha20;
#[test]
// https://github.com/floodyberry/poly1305-donna
use core::cmp::min;
-use core::convert::TryInto;
+
+use crate::prelude::*;
#[derive(Clone, Copy)]
pub struct Poly1305 {
#[cfg(test)]
mod test {
use core::iter::repeat;
- use alloc::vec::Vec;
use super::Poly1305;
}
mod prelude {
+ #![allow(unused_imports)]
+
pub use alloc::{vec, vec::Vec, string::String, collections::VecDeque, boxed::Box};
pub use alloc::borrow::ToOwned;
pub use alloc::string::ToString;
- pub use core::convert::{TryFrom, TryInto};
+ pub use core::convert::{AsMut, AsRef, TryFrom, TryInto};
+ pub use core::default::Default;
pub use core::marker::Sized;
pub(crate) use crate::util::hash_tables::*;
use crate::io;
use crate::prelude::*;
use core::{cmp,mem,fmt};
-use core::convert::TryInto;
use core::ops::Deref;
#[cfg(any(test, fuzzing, debug_assertions))]
use crate::sync::Mutex;
use bitcoin::secp256k1::Secp256k1;
use bitcoin::secp256k1::{PublicKey,SecretKey};
-use regex;
-
use crate::io;
use crate::prelude::*;
use alloc::collections::BTreeSet;
-use core::default::Default;
use core::iter::repeat;
use bitcoin::hashes::Hash;
use crate::sync::{Arc, Mutex, RwLock};
//! Utilities to generate inbound payment information in service of invoice creation.
-use alloc::string::ToString;
use bitcoin::hashes::{Hash, HashEngine};
use bitcoin::hashes::cmp::fixed_time_eq;
use bitcoin::hashes::hmac::{Hmac, HmacEngine};
use crate::util::errors::APIError;
use crate::util::logger::Logger;
-use core::convert::{TryFrom, TryInto};
+#[allow(unused_imports)]
+use crate::prelude::*;
+
use core::ops::Deref;
pub(crate) const IV_LEN: usize = 16;
#[allow(unused_imports)]
use crate::prelude::*;
-#[cfg(feature = "std")]
-use core::convert::TryFrom;
use core::fmt;
use core::fmt::Debug;
use core::ops::Deref;
#[cfg(test)]
mod tests {
- use std::convert::TryFrom;
use bitcoin::{Transaction, TxIn, ScriptBuf, Sequence, Witness, TxOut};
use hex::DisplayHex;
use crate::ln::{PaymentPreimage, PaymentHash, PaymentSecret};
use crate::io;
use crate::prelude::*;
-use core::default::Default;
use bitcoin::hashes::hex::FromHex;
use crate::ln::functional_test_utils::*;
use bitcoin::secp256k1::{PublicKey, Scalar, Secp256k1, SecretKey};
use crate::io::{Cursor, Read};
-use core::convert::{AsMut, TryInto};
use core::ops::Deref;
#[allow(unused_imports)]
use crate::prelude::*;
use crate::io;
-use alloc::collections::VecDeque;
use crate::sync::{Mutex, MutexGuard, FairRwLock};
use core::sync::atomic::{AtomicBool, AtomicU32, AtomicI32, Ordering};
use core::{cmp, hash, fmt, mem};
use crate::util::test_utils;
use crate::prelude::*;
-use core::default::Default;
use crate::ln::functional_test_utils::*;
use bitcoin::hash_types::BlockHash;
use crate::prelude::*;
-use core::default::Default;
use crate::sync::Mutex;
use crate::ln::functional_test_utils::*;
use crate::ln::msgs::DecodeError;
use crate::util::ser::{Readable, Writeable, Writer};
-use core::convert::TryFrom;
use crate::io;
+#[allow(unused_imports)]
+use crate::prelude::*;
+
/// A script pubkey for shutting down a channel as defined by [BOLT #2].
///
/// [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
#[cfg(test)]
mod shutdown_script_tests {
use super::ShutdownScript;
+
+ use bitcoin::address::{WitnessProgram, WitnessVersion};
use bitcoin::blockdata::opcodes;
use bitcoin::blockdata::script::{Builder, ScriptBuf};
use bitcoin::secp256k1::Secp256k1;
use bitcoin::secp256k1::{PublicKey, SecretKey};
+
use crate::ln::features::InitFeatures;
- use core::convert::TryFrom;
- use bitcoin::address::{WitnessProgram, WitnessVersion};
+ use crate::prelude::*;
fn pubkey() -> bitcoin::key::PublicKey {
let secp_ctx = Secp256k1::signing_only();
use crate::util::errors::APIError;
use crate::util::config::UserConfig;
use crate::util::string::UntrustedString;
+use crate::prelude::*;
use bitcoin::{Transaction, TxOut};
use bitcoin::blockdata::locktime::absolute::LockTime;
use bitcoin::network::constants::Network;
use bitcoin::address::{WitnessProgram, WitnessVersion};
-use regex;
-
-use core::default::Default;
-use std::convert::TryFrom;
-
use crate::ln::functional_test_utils::*;
#[test]
mod tests {
use super::*;
use crate::prelude::*;
- use core::convert::TryInto;
use crate::ln::peer_handler::IgnoringMessageHandler;
// Big-endian wire encoding of Pong message (type = 19, byteslen = 2).
use bitcoin::secp256k1::schnorr::Signature;
use bitcoin::address::{Address, Payload, WitnessProgram, WitnessVersion};
use bitcoin::key::TweakedPublicKey;
-use core::convert::{AsRef, TryFrom};
use core::time::Duration;
use crate::io;
use crate::blinded_path::BlindedPath;
use bitcoin::secp256k1::{Message, Secp256k1, XOnlyPublicKey, self};
use bitcoin::address::{Address, Payload, WitnessProgram, WitnessVersion};
use bitcoin::key::TweakedPublicKey;
- use core::convert::TryFrom;
+
use core::time::Duration;
+
use crate::blinded_path::{BlindedHop, BlindedPath};
use crate::sign::KeyMaterial;
use crate::ln::features::{Bolt12InvoiceFeatures, InvoiceRequestFeatures, OfferFeatures};
use crate::offers::invoice_request::InvoiceRequestTlvStreamRef;
use crate::offers::merkle::{SignError, SignatureTlvStreamRef, TaggedHash, self};
use crate::offers::offer::{Amount, OfferTlvStreamRef, Quantity};
+ use crate::prelude::*;
#[cfg(not(c_bindings))]
use {
crate::offers::offer::OfferBuilder,
use bitcoin::network::constants::Network;
use bitcoin::secp256k1::{KeyPair, PublicKey, Secp256k1, self};
use bitcoin::secp256k1::schnorr::Signature;
-use core::convert::{AsRef, TryFrom};
use core::ops::Deref;
use crate::sign::EntropySource;
use crate::io;
use bitcoin::blockdata::constants::ChainHash;
use bitcoin::network::constants::Network;
use bitcoin::secp256k1::{KeyPair, Secp256k1, SecretKey, self};
- use core::convert::TryFrom;
use core::num::NonZeroU64;
#[cfg(feature = "std")]
use core::time::Duration;
use bitcoin::hashes::{Hash, HashEngine, sha256};
use bitcoin::secp256k1::{Message, PublicKey, Secp256k1, self};
use bitcoin::secp256k1::schnorr::Signature;
-use core::convert::AsRef;
use crate::io;
use crate::util::ser::{BigSize, Readable, Writeable, Writer};
use bitcoin::blockdata::constants::ChainHash;
use bitcoin::network::constants::Network;
use bitcoin::secp256k1::{KeyPair, PublicKey, Secp256k1, self};
-use core::convert::TryFrom;
use core::hash::{Hash, Hasher};
use core::num::NonZeroU64;
use core::ops::Deref;
use bitcoin::blockdata::constants::ChainHash;
use bitcoin::network::constants::Network;
use bitcoin::secp256k1::Secp256k1;
- use core::convert::TryFrom;
use core::num::NonZeroU64;
use core::time::Duration;
use crate::blinded_path::{BlindedHop, BlindedPath};
use bitcoin::bech32;
use bitcoin::secp256k1;
-use core::convert::TryFrom;
use crate::io;
use crate::ln::msgs::DecodeError;
use crate::util::ser::SeekReadable;
mod sealed {
use bitcoin::bech32;
use bitcoin::bech32::{FromBase32, ToBase32};
- use core::convert::TryFrom;
use core::fmt;
use super::Bolt12ParseError;
use bitcoin::blockdata::constants::ChainHash;
use bitcoin::network::constants::Network;
use bitcoin::secp256k1::{PublicKey, Secp256k1, self};
-use core::convert::TryFrom;
use core::hash::{Hash, Hasher};
use core::ops::Deref;
use core::str::FromStr;
use bitcoin::blockdata::constants::ChainHash;
use bitcoin::network::constants::Network;
use bitcoin::secp256k1::{KeyPair, Secp256k1, SecretKey};
- use core::convert::TryFrom;
+
use core::time::Duration;
+
use crate::blinded_path::{BlindedHop, BlindedPath};
use crate::sign::KeyMaterial;
use crate::ln::channelmanager::PaymentId;
use crate::offers::test_utils::*;
use crate::util::ser::{BigSize, Writeable};
use crate::util::string::PrintableString;
+ use crate::prelude::*;
trait ToBytes {
fn to_bytes(&self) -> Vec<u8>;
use bitcoin::hashes::hmac::{Hmac, HmacEngine};
use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::secp256k1::{KeyPair, PublicKey, Secp256k1, SecretKey, self};
-use core::convert::TryFrom;
use core::fmt;
use crate::ln::channelmanager::PaymentId;
use crate::ln::inbound_payment::{ExpandedKey, IV_LEN, Nonce};
use bitcoin::secp256k1::{KeyPair, PublicKey, Secp256k1, SecretKey};
use bitcoin::secp256k1::schnorr::Signature;
-use core::convert::AsRef;
+
use core::time::Duration;
use crate::blinded_path::{BlindedHop, BlindedPath};
use crate::sign::EntropySource;
use crate::offers::invoice::BlindedPayInfo;
use crate::offers::merkle::TaggedHash;
+#[allow(unused_imports)]
+use crate::prelude::*;
+
pub(crate) fn fail_sign<T: AsRef<TaggedHash>>(_message: &T) -> Result<Signature, ()> {
Err(())
}
//! Message handling for BOLT 12 Offers.
-use core::convert::TryFrom;
use core::fmt;
use crate::io::{self, Read};
use crate::ln::msgs::DecodeError;
use crate::io_extras::{copy, sink};
use crate::prelude::*;
use core::{cmp, fmt};
-use core::convert::TryFrom;
use crate::sync::{RwLock, RwLockReadGuard, LockTestExt};
#[cfg(feature = "std")]
use core::sync::atomic::{AtomicUsize, Ordering};
use crate::prelude::*;
use crate::sync::Arc;
- use core::convert::TryInto;
-
fn get_channel_details(short_channel_id: Option<u64>, node_id: PublicKey,
features: InitFeatures, outbound_capacity_msat: u64) -> channelmanager::ChannelDetails {
channelmanager::ChannelDetails {
use std::time::Duration;
use bitcoin::hashes::Hash;
- use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
+ use bitcoin::secp256k1::SecretKey;
use crate::chain::transaction::OutPoint;
use crate::routing::scoring::ScoreUpdate;
- use crate::sign::{EntropySource, KeysManager};
+ use crate::sign::KeysManager;
use crate::ln::ChannelId;
- use crate::ln::channelmanager::{self, ChannelCounterparty, ChannelDetails};
- use crate::ln::features::Bolt11InvoiceFeatures;
- use crate::routing::gossip::NetworkGraph;
+ use crate::ln::channelmanager::{self, ChannelCounterparty};
use crate::util::config::UserConfig;
- use crate::util::ser::ReadableArgs;
use crate::util::test_utils::TestLogger;
/// Tries to open a network graph file, or panics with a URL to fetch it.
use crate::prelude::*;
use core::{cmp, fmt};
-use core::convert::TryInto;
use core::ops::{Deref, DerefMut};
use core::time::Duration;
use crate::io::{self, Read};
use super::*;
use crate::routing::gossip::tests::*;
use crate::util::test_utils::{TestChainSource, TestLogger};
- use crate::ln::msgs;
use bitcoin::secp256k1::{Secp256k1, SecretKey};
use crate::offers::invoice_request::UnsignedInvoiceRequest;
use crate::prelude::*;
-use core::convert::TryInto;
use core::ops::Deref;
use core::sync::atomic::{AtomicUsize, Ordering};
#[cfg(taproot)]
use crate::ln::script::ShutdownScript;
-use alloc::string::String;
+#[allow(unused_imports)]
+use crate::prelude::*;
+
use core::fmt;
/// Indicates an error on the client's part (usually some variant of attempting to use too-low or
//! This module has a map which can be iterated in a deterministic order. See the [`IndexedMap`].
use crate::prelude::*;
-use alloc::vec::Vec;
use alloc::slice::Iter;
use core::hash::Hash;
-use core::cmp::Ord;
use core::ops::{Bound, RangeBounds};
/// A map which can be iterated in a deterministic order.
//! [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
use core::cmp;
-use core::convert::{TryFrom, TryInto};
use core::ops::Deref;
use core::str::FromStr;
use bitcoin::{BlockHash, Txid};
use crate::{io, log_error};
-use crate::alloc::string::ToString;
use crate::prelude::*;
use crate::chain;
#[cfg(test)]
mod tests {
use super::*;
- use crate::chain::chainmonitor::Persist;
use crate::chain::ChannelMonitorUpdateStatus;
use crate::events::{ClosureReason, MessageSendEventsProvider};
use crate::ln::functional_test_utils::*;
use crate::sign::EntropySource;
use crate::crypto::chacha20::ChaCha20;
use crate::util::scid_utils;
+ use crate::prelude::*;
- use core::convert::TryInto;
use core::ops::Deref;
const TEST_SEGWIT_ACTIVATION_HEIGHT: u32 = 1;
use core::hash::Hash;
use crate::sync::{Mutex, RwLock};
use core::cmp;
-use core::convert::TryFrom;
use core::ops::Deref;
use alloc::collections::BTreeMap;
use bitcoin::consensus::Encodable;
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
use bitcoin::hash_types::{Txid, BlockHash};
-use core::marker::Sized;
use core::time::Duration;
use crate::chain::ClaimId;
use crate::ln::msgs::DecodeError;
#[cfg(test)]
mod tests {
- use core::convert::TryFrom;
use bitcoin::hashes::hex::FromHex;
use bitcoin::secp256k1::ecdsa;
use crate::util::ser::{Readable, Hostname, Writeable};
+ use crate::prelude::*;
#[test]
fn hostname_conversion() {
//! Utilities for strings.
-use alloc::string::String;
use core::fmt;
use crate::io::{self, Read};
use crate::ln::msgs;
use crate::util::ser::{Writeable, Writer, Readable};
+#[allow(unused_imports)]
+use crate::prelude::*;
+
/// Struct to `Display` fields in a safe way using `PrintableString`
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
pub struct UntrustedString(pub String);
use bitcoin::secp256k1::ecdsa::{RecoverableSignature, Signature};
use bitcoin::secp256k1::schnorr;
-#[cfg(any(test, feature = "_test_utils"))]
-use regex;
-
use crate::io;
use crate::prelude::*;
use core::cell::RefCell;
use super::*;
use bitcoin::blockdata::locktime::absolute::LockTime;
- use bitcoin::blockdata::transaction::{Transaction, TxOut, TxIn, OutPoint};
- use bitcoin::blockdata::script::{ScriptBuf, Builder};
+ use bitcoin::blockdata::transaction::{TxIn, OutPoint};
+ use bitcoin::blockdata::script::Builder;
use bitcoin::hash_types::{PubkeyHash, Txid};
use bitcoin::hashes::Hash;
use bitcoin::hashes::hex::FromHex;
use super::*;
use core::sync::atomic::{AtomicBool, Ordering};
use core::future::Future as FutureTrait;
- use core::task::{Context, Poll, RawWaker, RawWakerVTable, Waker};
+ use core::task::{RawWaker, RawWakerVTable};
#[test]
fn notifier_pre_notified_future() {