awfm9/alvalor-go

Improve miner & node integration

awfm9 opened this issue · 0 comments

awfm9 commented

Currently, there is kind of a mismatch between the mining code and the node code, where the miner will request a list of transaction IDs from the node on each new transaction. This was done so we don't keep a trie of transactions in both the miner and the node. However, if the network is busy (many new transactions) or there is a big memory pool (network capacity not big enough), these calls become expensive fast and could turn into a bottleneck.

A better approach would be to forget about actual transactions in the miner alltogether and just remember the delta hash of the current memory pool we are mining on top of. Then the node needs to implement some sort of memory pool snapshotting so we can quickly roll back the trie to the state we mined on when a new block is found.