]> Untitled Git - bdk/commitdiff
use flatten instead of unwrap_or
authorRiccardo Casatta <riccardo@casatta.it>
Tue, 17 Nov 2020 14:24:26 +0000 (15:24 +0100)
committerRiccardo Casatta <riccardo@casatta.it>
Tue, 17 Nov 2020 14:24:26 +0000 (15:24 +0100)
src/blockchain/utils.rs

index 79c9c9f09e59bb512fafb64236c02e3d5626c586..dd5de887294741720fdb3dd4fcb6b17156eaf0a7 100644 (file)
@@ -159,7 +159,7 @@ pub trait ElectrumLikeSync {
 
         // save any tx details not in db but in history_txs_id or with different height/timestamp
         for txid in history_txs_id.iter() {
-            let height = *txid_height.get(txid).unwrap_or(&None);
+            let height = txid_height.get(txid).cloned().flatten();
             let timestamp = *new_timestamps.get(txid).unwrap_or(&0u64);
             if let Some(tx_details) = txs_details_in_db.get(txid) {
                 // check if height matches, otherwise updates it