#![crate_name = "lightning_signer"]
#![forbid(unsafe_code)]
#![allow(bare_trait_objects)]
#![allow(ellipsis_inclusive_range_patterns)]
#![warn(rustdoc::broken_intra_doc_links)]
#![warn(missing_docs)]
#![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
#[cfg(not(any(feature = "std", feature = "no-std")))]
compile_error!("at least one of the `std` or `no-std` features must be enabled");
#[cfg(not(feature = "std"))]
extern crate core2;
#[macro_use]
extern crate alloc;
extern crate core;
#[cfg(feature = "grpc")]
extern crate tonic;
pub use bitcoin;
pub use lightning;
pub use lightning_invoice;
pub use txoo;
pub mod chain;
#[macro_use]
pub mod util;
#[macro_use]
pub mod channel;
pub mod monitor;
#[macro_use]
pub mod node;
pub mod invoice;
pub mod persist;
pub mod policy;
pub mod signer;
pub mod tx;
pub mod wallet;
#[cfg(not(feature = "std"))]
mod io_extras {
pub use core2::io::{self, Error, Read, Write};
pub struct Sink {
_priv: (),
}
pub const fn sink() -> Sink {
Sink { _priv: () }
}
impl core2::io::Write for Sink {
#[inline]
fn write(&mut self, buf: &[u8]) -> core2::io::Result<usize> {
Ok(buf.len())
}
#[inline]
fn flush(&mut self) -> core2::io::Result<()> {
Ok(())
}
}
}
#[cfg(feature = "std")]
mod io_extras {
pub use std::io::{self, sink, Error, Read};
}
pub use io_extras::io;
#[doc(hidden)]
pub use alloc::collections::BTreeSet as OrderedSet;
#[doc(hidden)]
pub use alloc::rc::Rc;
#[doc(hidden)]
pub use alloc::sync::{Arc, Weak};
use bitcoin::secp256k1::PublicKey;
use lightning::ln::chan_utils::ChannelTransactionParameters;
#[cfg(not(feature = "std"))]
mod nostd;
pub mod prelude {
pub use alloc::{boxed::Box, string::String, vec, vec::Vec};
pub use hashbrown::HashMap as Map;
pub use hashbrown::HashSet as UnorderedSet;
pub use alloc::collections::BTreeMap as OrderedMap;
pub use alloc::collections::BTreeSet as OrderedSet;
pub use alloc::borrow::ToOwned;
pub use alloc::string::ToString;
#[cfg(not(feature = "std"))]
pub use crate::nostd::*;
#[cfg(feature = "std")]
pub use std::sync::{Mutex, MutexGuard};
#[cfg(feature = "std")]
pub trait SendSync: Send + Sync {}
}
#[doc(hidden)]
pub use prelude::SendSync;
use prelude::*;
#[cfg(feature = "std")]
mod sync {
pub use ::std::sync::{Arc, Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, Weak};
}
pub trait CommitmentPointProvider: SendSync {
fn get_holder_commitment_point(&self, commitment_number: u64) -> PublicKey;
fn get_counterparty_commitment_point(&self, commitment_number: u64) -> Option<PublicKey>;
fn get_transaction_parameters(&self) -> ChannelTransactionParameters;
fn clone_box(&self) -> Box<dyn CommitmentPointProvider>;
}
impl Clone for Box<dyn CommitmentPointProvider> {
fn clone(&self) -> Self {
(**self).clone_box()
}
}
#[cfg(not(feature = "std"))]
#[allow(unused)]
mod sync;
#[cfg(test)]
mod ready_channel_tests;
#[cfg(test)]
mod sign_counterparty_commitment_tests;
#[cfg(test)]
mod sign_counterparty_htlc_sweep_tests;
#[cfg(test)]
mod sign_delayed_sweep_tests;
#[cfg(test)]
mod sign_holder_commitment_tests;
#[cfg(test)]
mod sign_htlc_tx_tests;
#[cfg(test)]
mod sign_justice_sweep_tests;
#[cfg(test)]
mod sign_mutual_close_tests;
#[cfg(test)]
mod sign_onchain_tx_tests;
#[cfg(test)]
mod validate_counterparty_revocation_tests;
#[cfg(test)]
mod validate_holder_commitment_tests;