Przeglądaj źródła

drk get-tx: assert tx hash matches

x 3 lat temu
rodzic
commit
defece9c00
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      bin/drk/src/main.rs

+ 3 - 1
bin/drk/src/main.rs

@@ -912,12 +912,14 @@ async fn main() -> Result<()> {
 
                 let tx =
                     drk.get_tx(&tx_hash).await.with_context(|| "Failed to fetch transaction")?;
-                let _ = if let Some(tx) = tx {
+                let tx = if let Some(tx) = tx {
                     tx
                 } else {
                     eprintln!("Tx not found");
                     exit(1);
                 };
+                // Make sure the tx is correct
+                assert_eq!(tx.hash(), tx_hash);
 
                 println!("Transaction ID: {}", tx_hash);
                 let is_err = drk