#![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");
#[macro_use]
extern crate alloc;
extern crate core;
#[cfg(feature = "grpc")]
extern crate tonic;
pub use bitcoin;
use bitcoin::Transaction;
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;
pub use hex;
#[doc(hidden)]
pub use alloc::collections::BTreeSet as OrderedSet;
#[doc(hidden)]
pub use alloc::rc::Rc;
use bitcoin::secp256k1::PublicKey;
use lightning::ln::chan_utils::ChannelTransactionParameters;
#[cfg(not(feature = "std"))]
mod nostd;
#[doc(hidden)]
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 = "shuttle"))]
pub use alloc::sync::{Arc, Weak};
#[cfg(feature = "shuttle")]
pub use shuttle::sync::{Arc, Mutex, MutexGuard, Weak};
#[cfg(all(feature = "std", not(feature = "shuttle")))]
pub use std::sync::{Mutex, MutexGuard};
#[cfg(not(feature = "std"))]
pub use crate::nostd::*;
#[cfg(feature = "std")]
pub trait SendSync: Send + Sync {}
}
#[doc(hidden)]
pub use prelude::SendSync;
use crate::util::status::Status;
use prelude::*;
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 get_spendable_htlc_indices(
&self,
tx: &Transaction,
commitment_number: u64,
) -> Result<Vec<u32>, Status>;
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 setup_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;