iron-fish / ironfish

A novel cryptocurrency focused on privacy and accessibility.
https://ironfish.network
Mozilla Public License 2.0
964 stars 579 forks source link

Wallet cleanup should use an iter to load records #5098

Closed NullSoldier closed 4 days ago

NullSoldier commented 4 days ago

Summary

In the case that the records to cleanup is very high, we shouldn't load all of them in memory before cleaning up. We should only load 1 leveldb memory block at most. This will ensure if there is a bad feedback loop this list won't permanently grow and continue to use more memory as it tries to clean up accounts.

This also ensures that the account record deletion is considered a record so deleting thousands of empty account cleanup records doesn't run forever.

Testing Plan

Running this with a lot of wallets and using the reset command.

Documentation

Does this change require any updates to the Iron Fish Docs (ex. the RPC API Reference)? If yes, link a related documentation pull request for the website.

[ ] Yes

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and label it with breaking-change-rpc or breaking-change-sdk.

[ ] Yes