Fix LastSeenMessage and Validators count issue#1802
Fix LastSeenMessage and Validators count issue#1802shargon merged 2 commits intoneo-project:master-2.xfrom
Conversation
|
Tested. Vote 4 CN to 7 CN, switch smoothly and no |
shargon
left a comment
There was a problem hiding this comment.
The code looks good but I see the following points:
- We save the lastSeen by publicKey instead of by index, but it's needed? this requires comparing by public key, which is slower than an array, but is more accurate.
- It does not contain a cleaning logic, if we change the CN each block will increase the memory of the node until break it.
If consensus changed, |
| int count = (int)snapshot.ValidatorsCount.Get().Votes.Select((p, i) => new | ||
| { | ||
| Count = i, | ||
| Count = i + 1, |
There was a problem hiding this comment.
Because we use Votes.Length - 1 as index when add votes.
Line 481 in 75df7cd
Line 509 in 75df7cd
And as @superboyiii described in #1799. Only 6 nodes became validators after vote 7 validators.
|
@igormcoelho @vncoelho @erikzhang @Tommo-L Please have a look? |
|
@erikzhang Shall we merge? |
|
Retest it based on my local repository (merged this with neox-2.x and master-2.x)
@shargon Please help us merge this. |
Close #1799
Changes:
LastSeenMessagein order to cover scenario like this:How to test and verify the impact of these changes?
Where in the software does this update applies to?
@erikzhang @shargon How about fix like this?