use crate::disk;
use crate::hex_utils;
use crate::{
- ChannelManager, FilesystemLogger, HTLCDirection, HTLCStatus, MillisatAmount, PaymentInfo,
+ ChannelManager, FilesystemLogger, HTLCStatus, MillisatAmount, PaymentInfo,
PaymentInfoStorage, PeerManager,
};
use bitcoin::hashes::sha256::Hash as Sha256Hash;
let payments = payment_storage.lock().unwrap();
print!("[");
for (payment_hash, payment_info) in payments.deref() {
- let direction_str = match payment_info.direction {
- HTLCDirection::Inbound => "inbound",
- HTLCDirection::Outbound => "outbound",
- };
println!("");
println!("\t{{");
println!("\t\tamount_millisatoshis: {},", payment_info.amt_msat);
println!("\t\tpayment_hash: {},", hex_utils::hex_str(&payment_hash.0));
- println!("\t\thtlc_direction: {},", direction_str);
+ // println!("\t\thtlc_direction: {},", direction_str);
println!(
"\t\thtlc_status: {},",
match payment_info.status {
PaymentInfo {
preimage: None,
secret: payment_secret,
- direction: HTLCDirection::Outbound,
status,
amt_msat: MillisatAmount(Some(amt_msat)),
},
// Otherwise lnd errors with "destination hop doesn't understand payment addresses"
// (for context, lnd calls payment secrets "payment addresses").
secret: None,
- direction: HTLCDirection::Inbound,
status: HTLCStatus::Pending,
amt_msat: MillisatAmount(Some(amt_msat)),
},
use std::time::{Duration, SystemTime};
use tokio::sync::mpsc;
-#[derive(PartialEq)]
-pub(crate) enum HTLCDirection {
- Inbound,
- Outbound,
-}
-
pub(crate) enum HTLCStatus {
Pending,
Succeeded,
pub(crate) struct PaymentInfo {
preimage: Option<PaymentPreimage>,
secret: Option<PaymentSecret>,
- direction: HTLCDirection,
status: HTLCStatus,
amt_msat: MillisatAmount,
}
PaymentInfo {
preimage: None,
secret: None,
- direction: HTLCDirection::Inbound,
status: HTLCStatus::Failed,
amt_msat: MillisatAmount(None),
},