From 2844ddec63c3e16ef2e029676ce486e3d867005f Mon Sep 17 00:00:00 2001 From: Riccardo Casatta Date: Tue, 17 Nov 2020 15:19:09 +0100 Subject: [PATCH] avoid a max() call by checking minus or equal --- src/blockchain/utils.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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); }