-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Conversation
@@ -276,6 +296,9 @@ private void produceQueue() { | |||
if (wrapper.isNewBlock() && !syncDone) { | |||
makeSyncDone(); | |||
} | |||
if (config.makeDoneByTimeout() >= 0) { | |||
this.lastSyncAction = LocalDateTime.now(); |
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.
Do we need this update? During our latest discussion we decided to count that time from sync start up, not from last imported block
Hi, We said, we make sync done when the last known block arrived, instead of waiting for a new block. The timeout applied in the header retriever loop to make sync done if no peer was responding after this time only if the know best block was not updated since Ethereum start (standalone node or in a private network but disconnected from other nodes) |
@pschweitz I think we could remove updating timer on every block, but we couldn't remove it with first peer, because it's pretty common to have private networks with more than 2 peers. And those peers could be on different height. So it could go buggy in that cases. |
@pschweitz isn't it similar behavior? in your case it's delayed to wait for new peer, here it's delayed for network exploring with no regard on what's happening with peers. |
@zilm13 Once synchronized, it isn't the job of the header retriever loop to fill potential missing blocks afterwards , up to the real final best block ? (the loop you didn't want me to break it I understand well) Otherwise if we extrapolate was you explained, we never could ensure having synchronized everything properly, whatever the number of nodes involved in the network, because it could happen that we reach a networking status (Murphy's Law), where the nodes are disconnected between themselves after all (as you have a probabilist approach). Then shouldn't be one job of the Ethereum protocol to recognize the legitimate blockchain at re-connection ? @mkalinin Thanks to both of you for your support |
@pschweitz checking node in "active peers" list doesn't mean another node couldn't connect to you, moreover it's the way people sync in private networks too. Plus you could have outdated list with, say, 2 peers live and 3rd - not used today. |
I am up to merge. guys? |
Yes, you can merge when you feel confident about the content. I will test again and give you a feedback on Monday. |
I confirm everything is working like expected. Thanks a lot for your work. I would just add one last suggestion. A big part of this work is also for letting developers working faster onto a standalone node. And around this new timeout, there was a timer scheduled every 10 seconds. I would suggest to reduce this scheduling to 1 second at line 189 of the SyncManager.java. It will not have so much impact during the application runtime. Otherwise I am sure this changes will increase adoption of this Java/blockchain solution by the developers thanks to more simplicity at the beginning ! |
@pschweitz you could set in config now or pass in command line, use |
Thanks @zilm13 Sorry if I was not clear in my last post, I just was telling that even if you set 1 sec of timeout, you will wait for at least 10 seconds, because of the timer that performs the check that is run every 10 sec only... line 189 of the SyncManager.java |
@pschweitz ahhhh I got you. I think we could decrease it to 1/2 seconds |
yes we can |
@pschweitz done a2f5061 , but in develop only, not urgent I think |
Possible alternative for #1093
Some thoughts:
we couldn't have block hash + total difficulty in
validateAndAddNewBlock
as there could be gaps etc, so not much sense to increase code difficulty (not a good thing to compare only block number) for this custom hack