Switch IndexMap to HashMap
This commit is contained in:
parent
c5e308389b
commit
95557427c8
23
Cargo.lock
generated
23
Cargo.lock
generated
@ -426,12 +426,6 @@ dependencies = [
|
||||
"slip21",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.2.8"
|
||||
@ -573,12 +567,6 @@ version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
@ -675,16 +663,6 @@ dependencies = [
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "instant"
|
||||
version = "0.1.12"
|
||||
@ -861,7 +839,6 @@ dependencies = [
|
||||
"hex",
|
||||
"hyper",
|
||||
"hyperlocal",
|
||||
"indexmap",
|
||||
"itertools",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
|
||||
@ -64,7 +64,6 @@ tokio = { version = "1", features = ["sync", "macros"] }
|
||||
|
||||
# optional dependencies for electrum-discovery
|
||||
electrum-client = { version = "0.8", optional = true }
|
||||
indexmap = "2.2.5"
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@ -2,7 +2,6 @@ use bitcoin::hashes::sha256d::Hash as Sha256dHash;
|
||||
#[cfg(not(feature = "liquid"))]
|
||||
use bitcoin::util::merkleblock::MerkleBlock;
|
||||
use bitcoin::VarInt;
|
||||
use indexmap::IndexMap;
|
||||
use itertools::Itertools;
|
||||
use rayon::prelude::*;
|
||||
use sha2::{Digest, Sha256};
|
||||
@ -549,7 +548,7 @@ impl ChainQuery {
|
||||
});
|
||||
|
||||
// collate utxo funding/spending events by transaction
|
||||
let mut map: IndexMap<Txid, TxHistorySummary> = IndexMap::new();
|
||||
let mut map: HashMap<Txid, TxHistorySummary> = HashMap::new();
|
||||
for (txid, info, height, time) in rows {
|
||||
if !map.contains_key(&txid) && map.len() == limit {
|
||||
break;
|
||||
@ -604,7 +603,15 @@ impl ChainQuery {
|
||||
}
|
||||
}
|
||||
|
||||
map.into_values().collect()
|
||||
let mut tx_summaries = map.into_values().collect::<Vec<TxHistorySummary>>();
|
||||
tx_summaries.sort_by(|a, b| {
|
||||
if a.height == b.height {
|
||||
a.value.cmp(&b.value)
|
||||
} else {
|
||||
b.height.cmp(&a.height)
|
||||
}
|
||||
});
|
||||
tx_summaries
|
||||
}
|
||||
|
||||
pub fn history(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user