Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously, the ETX set was stored the full list of referencable ETXs at a certain block. For example, if [ETX0, ETX1, ETX2] those ETXs would be written as the EtxSet for block 1. Then, when processing block 2, we may add some new ETXs to that set or remove some (perhaps none), and then write the new set to db. e.g, say block 2 spent ETX1, but added ETX3. The new EtxSet at block 2 would be [ETX0, ETX2, ETX3]. ETX0 and ETX2 are duplicated in each copy of the EtxSet. This problem gets exacerbated in real world scenarios with large numbers of ETXs. This patch makes it so we only store each ETX once, and the EtxSet we store is just a list of ETX hashes referencing the ETXs in the set. This way we don't store duplicate ETXs in the db. The tradeoff here, is that when we load the EtxSet, we now have to make many db reads to load each ETX in the set. A future patch can add a caching mechanism to mitigate this.
- Loading branch information