From: Riccardo Casatta Date: Tue, 17 Nov 2020 14:24:26 +0000 (+0100) Subject: use flatten instead of unwrap_or X-Git-Tag: v0.2.0~65^2~5 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/-script.html?a=commitdiff_plain;h=16fde66c6af92b4a093f73181375646d3228f59f;p=bdk use flatten instead of unwrap_or --- diff --git a/src/blockchain/utils.rs b/src/blockchain/utils.rs index 79c9c9f0..dd5de887 100644 --- a/src/blockchain/utils.rs +++ b/src/blockchain/utils.rs @@ -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