Merge pull request #2176 from TheBlueMatt/2023-04-expose-success-prob
[rust-lightning] / lightning / src / util / macro_logger.rs
index b7224be3ecea8cff537f3ea6373d71fd96716247..4836b4d6814f705cb111515a983733c4566e3a34 100644 (file)
@@ -8,14 +8,19 @@
 // licenses.
 
 use crate::chain::transaction::OutPoint;
-use crate::chain::keysinterface::SpendableOutputDescriptor;
+use crate::sign::SpendableOutputDescriptor;
 
 use bitcoin::hash_types::Txid;
 use bitcoin::blockdata::transaction::Transaction;
 
 use crate::routing::router::Route;
 use crate::ln::chan_utils::HTLCClaim;
-use crate::util::logger::DebugBytes;
+
+macro_rules! log_iter {
+       ($obj: expr) => {
+               $crate::util::logger::DebugIter($obj)
+       }
+}
 
 /// Logs a pubkey in hex format.
 #[macro_export]
@@ -36,10 +41,7 @@ macro_rules! log_bytes {
 pub(crate) struct DebugFundingChannelId<'a>(pub &'a Txid, pub u16);
 impl<'a> core::fmt::Display for DebugFundingChannelId<'a> {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
-               for i in (OutPoint { txid: self.0.clone(), index: self.1 }).to_channel_id().iter() {
-                       write!(f, "{:02x}", i)?;
-               }
-               Ok(())
+               (OutPoint { txid: self.0.clone(), index: self.1 }).to_channel_id().fmt(f)
        }
 }
 macro_rules! log_funding_channel_id {
@@ -51,7 +53,7 @@ macro_rules! log_funding_channel_id {
 pub(crate) struct DebugFundingInfo<'a, T: 'a>(pub &'a (OutPoint, T));
 impl<'a, T> core::fmt::Display for DebugFundingInfo<'a, T> {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
-               DebugBytes(&(self.0).0.to_channel_id()[..]).fmt(f)
+               (self.0).0.to_channel_id().fmt(f)
        }
 }
 macro_rules! log_funding_info {
@@ -68,6 +70,7 @@ impl<'a> core::fmt::Display for DebugRoute<'a> {
                        for h in p.hops.iter() {
                                writeln!(f, " node_id: {}, short_channel_id: {}, fee_msat: {}, cltv_expiry_delta: {}", log_pubkey!(h.pubkey), h.short_channel_id, h.fee_msat, h.cltv_expiry_delta)?;
                        }
+                       writeln!(f, " blinded_tail: {:?}", p.blinded_tail)?;
                }
                Ok(())
        }