Speeding up "getbalance <account>" calls



Summary:

Jan, the creator of Instawallet, implemented a suggestion from John Smith to speed up the server. The suggestion involved scanning the wallet every time a block came in or when something changed in the blockchain. This allowed for the accumulation of balances for all accounts in amortized linear time using a hash_map. Jan has created a branch on GitHub with the code for the cache and attached a patch file. He creates a list of all account balances every time a new block comes in or a transaction that affects his wallet appears. The list is stored in a "map," which he chose because he is new to C++ and was unsure what to use. However, since his VPS is low on memory, a tree-based implementation of map was used instead. There are plans to switch to a more recent version of the codebase in the future.


Updated on: 2023-05-26T18:30:09.087820+00:00