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
New definition for "out of sync" #1996
Conversation
@@ -35,13 +26,15 @@ func (f *FlowContext) ShouldMine() (bool, error) { | |||
} | |||
|
|||
now := mstime.Now().UnixMilliseconds() |
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 queries to virtual selected parent info are relatively expensive. It might make sense to maintain the virtual selected parent timestamp
by pushing virtual changes and only querying the current time against it with out acquiring the consensus lock.
@@ -50,7 +50,12 @@ func (flow *handleRelayedTransactionsFlow) start() error { | |||
return err | |||
} | |||
|
|||
if flow.IsIBDRunning() { | |||
isNearlySynced, err := flow.IsNearlySynced() |
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.
This might be a performance-sensitive location, if we don't optimize IsNearlySynced
using push updates as suggested above.
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.
Maybe it's fine to keep using IsIBDRunning
in here
if err != nil { | ||
return err | ||
} | ||
if !isNearlySynced && flow.IsIBDRunning() { |
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.
IsIBDRunning should be pretty fast, so I think it's better to check it first
@@ -50,7 +50,12 @@ func (flow *handleRelayedTransactionsFlow) start() error { | |||
return err | |||
} | |||
|
|||
if flow.IsIBDRunning() { | |||
isNearlySynced, err := flow.IsNearlySynced() |
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.
Maybe it's fine to keep using IsIBDRunning
in here
Codecov Report
@@ Coverage Diff @@
## dev #1996 +/- ##
==========================================
+ Coverage 57.19% 57.22% +0.02%
==========================================
Files 685 685
Lines 32982 32995 +13
==========================================
+ Hits 18865 18881 +16
+ Misses 11439 11436 -3
Partials 2678 2678
Continue to review full report at Codecov.
|
This PR modifies "out of sync" definition such that miners will mine under all possible circumstances.