witnet-rust icon indicating copy to clipboard operation
witnet-rust copied to clipboard

feat: allow keeping an index of utxos in memory

Open tmpolaczyk opened this issue 2 years ago • 1 comments

Fix #2173

This PR adds a new option in witnet.toml storage.utxos_in_memory that defaults to false. When enabled, the node will keep a map of address to list of UTXOs in memory, which allows to implement fast getBalance and getUtxoInfo methods. With this option enabled a call to getBalance takes around 5ms, while the same call with this option disabled may take up to 5000ms. The expected memory usage in mainnet is around 500 MB.

tmpolaczyk avatar Jul 28 '22 10:07 tmpolaczyk

Seems to work just fine 👍 Would appreciate feedback from @drcpu-github, who I suspect that will be the main user for this feature for the time being!

I'll try and have a look by integrating it in the test version of my explorer.

drcpu-github avatar Aug 11 '22 18:08 drcpu-github

@tmpolaczyk I have been testing this branch in the test version of my explorer and it works like a charm! I don't really notice any slowdown in either address lookups in the explorer or the building of the list of all accounts with a non-zero balance.

drcpu-github avatar Aug 20 '22 11:08 drcpu-github

Merged in as 2d497aad9e3c8fb27d431378ffa4917c351f5603

aesedepece avatar Aug 22 '22 11:08 aesedepece