From: Riccardo Casatta Date: Tue, 17 Nov 2020 14:19:09 +0000 (+0100) Subject: avoid a max() call by checking minus or equal X-Git-Tag: v0.2.0~65^2~6 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/enum.HexToArrayError.html?a=commitdiff_plain;h=2844ddec63c3e16ef2e029676ce486e3d867005f;p=bdk avoid a max() call by checking minus or equal --- diff --git a/src/blockchain/utils.rs b/src/blockchain/utils.rs index 73db08ce..79c9c9f0 100644 --- a/src/blockchain/utils.rs +++ b/src/blockchain/utils.rs @@ -111,11 +111,10 @@ pub trait ElectrumLikeSync { // el.height = -1 means unconfirmed with unconfirmed parents // el.height = 0 means unconfirmed with confirmed parents // but we threat those tx the same - let height = el.height.max(0); - if height == 0 { + if el.height <= 0 { txid_height.insert(el.tx_hash, None); } else { - txid_height.insert(el.tx_hash, Some(height as u32)); + txid_height.insert(el.tx_hash, Some(el.height as u32)); } history_txs_id.insert(el.tx_hash); }