-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Single stateroot sender #1953
Single stateroot sender #1953
Conversation
We're modifying it here, so there can be a race between this method and AddSignature().
Makes more sense because it's not just roots that we're relaying.
And don't add/resend it multiple times. 1. We can be in a setup with one SV only and no AddSignature() called at all. 2. AddSignature() might add M-1 signatures and our signature should be the last one to complete MPTRoot, but we'll never do that.
_ = time.AfterFunc(delay, func() { | ||
s.sendVote(ir) | ||
}) | ||
ir.retries++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mutex is taken on read only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
pkg/services/stateroot/service.go
Outdated
ir.isSent = true | ||
ir.Unlock() | ||
} | ||
s.srMtx.Unlock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this unlock before the if
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
These are arbitrary numbers, but that's what C# node uses. maxRetries could be set lower because we have exponential backoff anyway, but this works too.
Drop old incomplete roots from the map.
a10ee0d
to
3957174
Compare
Codecov Report
@@ Coverage Diff @@
## master #1953 +/- ##
==========================================
+ Coverage 82.71% 82.77% +0.06%
==========================================
Files 290 290
Lines 23328 23371 +43
==========================================
+ Hits 19295 19345 +50
+ Misses 2803 2790 -13
- Partials 1230 1236 +6
Continue to review full report at Codecov.
|
Problem
#1922 originally, but some additional fixes were also needed.