-
p4u authored
In order to avoid double vote check (on checkTx and deliverTx), we use a memory vote cache. An element can only be added to the vote cache during checkTx. Every 60 seconds (6 blocks) the old votes which are not yet in the blockchain will be removed from the cache. If the same vote (but different transaction) is send to the mempool, the cache will detect it and vote will be discarted. For enabling this mechanism, mempool.recheck must be set to False. So mempool transactions that do not enter into the next block won't be double checked. This job is now performed in a more efficient way by deliverTX. Finally vote related information stored in the blockchain voteTree has been reduced to the bare minimum necessary. This will reduce the size of the blockchain database. Benchmark results for encrypted-poll election with 5000 voters Before optimization: - Voting time: 2m30.666843743s - voteTree size: 8.2M After optimization: - Voting time: 1m21.283384761s - voteTree size: 4,4M Signed-off-by: p4u <pau@dabax.net>
3e5b1c70