Derive `Debug` and `Display` for `Route`
[rust-lightning] / lightning / src / routing / router.rs
index c20ce2e97ee835ca0cf2c77b8c7526c08dba5855..7862baf6322d7fd004c1cf7b3652beb35a336f3c 100644 (file)
@@ -341,7 +341,7 @@ impl Path {
 
 /// A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
 /// it can take multiple paths. Each path is composed of one or more hops through the network.
-#[derive(Clone, Hash, PartialEq, Eq)]
+#[derive(Clone, Debug, Hash, PartialEq, Eq)]
 pub struct Route {
        /// The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no
        /// [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be
@@ -380,6 +380,12 @@ impl Route {
        }
 }
 
+impl fmt::Display for Route {
+       fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+               log_route!(self).fmt(f)
+       }
+}
+
 const SERIALIZATION_VERSION: u8 = 1;
 const MIN_SERIALIZATION_VERSION: u8 = 1;