use ln::msgs;
use chain::transaction::OutPoint;
use chain::keysinterface::SpendableOutputDescriptor;
use bitcoin::blockdata::script::Script;
use secp256k1::key::PublicKey;
use std::time::Instant;
pub enum Event {
FundingGenerationReady {
temporary_channel_id: [u8; 32],
channel_value_satoshis: u64,
output_script: Script,
user_channel_id: u64,
},
FundingBroadcastSafe {
funding_txo: OutPoint,
user_channel_id: u64,
},
PaymentReceived {
payment_hash: [u8; 32],
amt: u64,
},
PaymentSent {
payment_preimage: [u8; 32],
},
PaymentFailed {
payment_hash: [u8; 32],
rejected_by_dest: bool,
},
PendingHTLCsForwardable {
time_forwardable: Instant,
},
SpendableOutputs {
outputs: Vec<SpendableOutputDescriptor>,
},
}
pub enum MessageSendEvent {
SendAcceptChannel {
node_id: PublicKey,
msg: msgs::AcceptChannel,
},
SendOpenChannel {
node_id: PublicKey,
msg: msgs::OpenChannel,
},
SendFundingCreated {
node_id: PublicKey,
msg: msgs::FundingCreated,
},
SendFundingSigned {
node_id: PublicKey,
msg: msgs::FundingSigned,
},
SendFundingLocked {
node_id: PublicKey,
msg: msgs::FundingLocked,
},
SendAnnouncementSignatures {
node_id: PublicKey,
msg: msgs::AnnouncementSignatures,
},
UpdateHTLCs {
node_id: PublicKey,
updates: msgs::CommitmentUpdate,
},
SendRevokeAndACK {
node_id: PublicKey,
msg: msgs::RevokeAndACK,
},
SendClosingSigned {
node_id: PublicKey,
msg: msgs::ClosingSigned,
},
SendShutdown {
node_id: PublicKey,
msg: msgs::Shutdown,
},
SendChannelReestablish {
node_id: PublicKey,
msg: msgs::ChannelReestablish,
},
BroadcastChannelAnnouncement {
msg: msgs::ChannelAnnouncement,
update_msg: msgs::ChannelUpdate,
},
BroadcastChannelUpdate {
msg: msgs::ChannelUpdate,
},
HandleError {
node_id: PublicKey,
action: Option<msgs::ErrorAction>
},
PaymentFailureNetworkUpdate {
update: msgs::HTLCFailChannelUpdate,
}
}
pub trait MessageSendEventsProvider {
fn get_and_clear_pending_msg_events(&self) -> Vec<MessageSendEvent>;
}
pub trait EventsProvider {
fn get_and_clear_pending_events(&self) -> Vec<Event>;
}