Преглед изворни кода

validator: log pow data type on confirmation

skoupidi пре 7 месеци
родитељ
комит
ecdb64bef5
2 измењених фајлова са 10 додато и 1 уклоњено
  1. 9 0
      src/blockchain/header_store.rs
  2. 1 1
      src/validator/mod.rs

+ 9 - 0
src/blockchain/header_store.rs

@@ -45,6 +45,15 @@ pub enum PowData {
     Monero(MoneroPowData),
 }
 
+impl fmt::Display for PowData {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self {
+            Self::DarkFi => write!(f, "PoW: DarkFi"),
+            Self::Monero(_) => write!(f, "PoW: Monero"),
+        }
+    }
+}
+
 #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, SerialEncodable, SerialDecodable)]
 // We have to introduce a type rather than using an alias so we can restrict API access.
 pub struct HeaderHash(pub [u8; 32]);

+ 1 - 1
src/validator/mod.rs

@@ -387,7 +387,7 @@ impl Validator {
         let mut state_inverse_diffs = vec![];
         info!(target: "validator::confirmation", "Confirming proposals:");
         for (index, proposal) in confirmed_proposals.iter().enumerate() {
-            info!(target: "validator::confirmation", "\t{proposal} - {}", confirmed_blocks[index].header.height);
+            info!(target: "validator::confirmation", "\t{proposal} ({}) - {}", confirmed_blocks[index].header.pow_data, confirmed_blocks[index].header.height);
             fork.overlay.lock().unwrap().overlay.lock().unwrap().apply_diff(&diffs[index])?;
             let next_difficulty = module.next_difficulty()?;
             module.append(&confirmed_blocks[index].header, &next_difficulty)?;