soteria-dag / soterd

A GoLang Implementation of Soteria DAG Protocol Daemon
http://www.soteriadag.org
ISC License
14 stars 9 forks source link

soterdash display all the blocks in dotted line. #8

Closed totaloutput closed 5 years ago

totaloutput commented 5 years ago

the blocks in soterdash is now dotted line, it was solid line before the commit: https://github.com/soteria-dag/soterdash/commit/3047fcd90231428f212a8a484eb92356d4e9e5b6

here is a screenshot of it: image

colakong commented 5 years ago

This was a regression introduced in fc811bc59404c51b691e22d5b670f8299999457b.

So by re-using the result of an old call to calculateBlueSet, we're not considering the latest 200 blocks in the colouring, which makes it more likely to get colouring wrong.

I wrote a test to identify differences in colouring between OrderDAG with and without caching. The test would most often fail, because a new virtual node would be added to blueSetCache on each call to OrderDAG (every generation). As a result, blueSetCache would have multiple VIRTUAL node entries, one for each generation, so when comparing blueSetCache between OrderDAG and OrderDAGNoCache, it would often compare VIRTUAL node entries from different generations, and fail because they don't have the same contents.

I've prepared a patch to fix the two issues. @jenlouie8's reviewing it, so we can decide what to do about the VIRTUAL node entries (in my patch I had it so that they aren't included in blueSetCache). If it looks good we'll merge and push, and this bug will be fixed :).

colakong commented 5 years ago

A fix for this was added in soterd commit 2625c407