avoid a max() call by checking minus or equal

This commit is contained in:
Riccardo Casatta 2020-11-17 15:19:09 +01:00
parent 7a58d3dd7a
commit 2844ddec63
No known key found for this signature in database
GPG Key ID: FD986A969E450397

View File

@ -111,11 +111,10 @@ pub trait ElectrumLikeSync {
// el.height = -1 means unconfirmed with unconfirmed parents // el.height = -1 means unconfirmed with unconfirmed parents
// el.height = 0 means unconfirmed with confirmed parents // el.height = 0 means unconfirmed with confirmed parents
// but we threat those tx the same // but we threat those tx the same
let height = el.height.max(0); if el.height <= 0 {
if height == 0 {
txid_height.insert(el.tx_hash, None); txid_height.insert(el.tx_hash, None);
} else { } 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); history_txs_id.insert(el.tx_hash);
} }