aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/blockchain.cpp
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2018-12-17 15:30:01 +0000
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-03-08 15:50:18 +0000
commit2d5cf4c41d86f2bdd1df99edc130ade1d093258f (patch)
treeff18c5329b17d9516e61f9d565a16dbf3e2f89ef /src/rpc/blockchain.cpp
parentefed9809b4fab34e33c3012aa3cf4b7a75d98ead (diff)
rpc: Speedup getrawmempool when verbose=true
Co-Authored-By: MarcoFalke <falke.marco@gmail.com>
Diffstat (limited to 'src/rpc/blockchain.cpp')
-rw-r--r--src/rpc/blockchain.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 1827aec637..2273d92f3f 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -474,7 +474,10 @@ UniValue MempoolToJSON(const CTxMemPool& pool, bool verbose)
const uint256& hash = e.GetTx().GetHash();
UniValue info(UniValue::VOBJ);
entryToJSON(pool, info, e);
- o.pushKV(hash.ToString(), info);
+ // Mempool has unique entries so there is no advantage in using
+ // UniValue::pushKV, which checks if the key already exists in O(N).
+ // UniValue::__pushKV is used instead which currently is O(1).
+ o.__pushKV(hash.ToString(), info);
}
return o;
} else {