bitpay / bitcore

A full stack for bitcoin and blockchain-based applications
https://bitcore.io/
MIT License
4.85k stars 2.09k forks source link

[BCN] Optimize pruneMempool #3574

Closed kajoseph closed 1 year ago

kajoseph commented 1 year ago

This PR optimizes TransactionStorage.pruneMempool by streamifying the data instead of storing all relevant txs and coins in memory.

I've also snuck in a logging fix for BWS. For high call volume, consecutive calls to console.time() with the same keys before console.timeEnd() would throw noisy errors in the logs such as:

(node:25) Warning: Label 'V8getUtxos' already exists for console.time()

which then cause

(node:25) Warning: No such label 'V8getUtxos' for console.timeEnd()

I fixed this by putting randomly generated identifiers in the key strings to prevent consecutive call conflicts.