-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
worker: some code enhancement on work.go #1174
Merged
brilliant-lx
merged 2 commits into
bnb-chain:develop
from
setunapo:worker_no_resubmit_interval_adjust
Nov 15, 2022
Merged
worker: some code enhancement on work.go #1174
brilliant-lx
merged 2 commits into
bnb-chain:develop
from
setunapo:worker_no_resubmit_interval_adjust
Nov 15, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brilliant-lx
requested review from
brilliant-lx,
unclezoro,
j75689,
kyrie-yl and
qinglin89
November 10, 2022 03:24
qinglin89
previously approved these changes
Nov 10, 2022
setunapo
force-pushed
the
worker_no_resubmit_interval_adjust
branch
from
November 10, 2022 03:55
956182d
to
bbb132f
Compare
setunapo
changed the title
WIP: remove resubmit ajust code of PoW.
worker: remove resubmit adjust code of PoW.
Nov 10, 2022
setunapo
force-pushed
the
worker_no_resubmit_interval_adjust
branch
2 times, most recently
from
November 10, 2022 07:15
bcc2e22
to
188c5ca
Compare
brilliant-lx
dismissed
qinglin89’s stale review
November 10, 2022 07:18
The base branch was changed.
resubmit intervalAdjust is for PoW only, to remove it to make worker simpler. With PoW, there will be a periodic timer to check if it is the time to stop packing transaction and start calculating the desired hash value, since other miner could succeed in hash compute if it spends too much time packing transactions. It will commit the current fruit to calculate root at a reasonable time. And it will schedule a new work to get a big block if new transaction was received. When there are too many transactions in the TxPool, the interval of the resubmit timer would be increased and vice versa. But it is not needed with PoS related consensus, since the block interval is determined in PoS, and there is already a timer to stop too long packing.
setunapo
force-pushed
the
worker_no_resubmit_interval_adjust
branch
from
November 10, 2022 07:20
188c5ca
to
5eff61c
Compare
brilliant-lx
previously approved these changes
Nov 10, 2022
brilliant-lx
changed the title
worker: remove resubmit adjust code of PoW.
worker: some code enhancement on work.go
Nov 10, 2022
bitdaddy89
previously approved these changes
Nov 10, 2022
channel operation is preferred than atomic value check in golang. And it will help for the further refactor on worker.
setunapo
force-pushed
the
worker_no_resubmit_interval_adjust
branch
from
November 10, 2022 07:37
dcc6329
to
4728db7
Compare
keefel
approved these changes
Nov 15, 2022
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.
LGTM
unclezoro
approved these changes
Nov 15, 2022
This was referenced Nov 29, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The code of work.go is critical for BSC block generation.
Try to do some code enhancement for it:
1.the resubmit intervalAdjust code was for PoW consensus, can be deleted.
2.change the work interrupt from atomic check to channel communication.
Rationale
With PoW, there will be a periodic timer to check if it is the time to stop packing transaction and start calculating the desired hash value, since other miner could succeed in hash compute if it spends too much time packing transactions.
It will commit the current fruit to calculate root at a reasonable time.
And it will schedule a new work to get a big block if new transaction was received.
When there are too many transactions in the TxPool, the interval of the resubmit timer would be increased and vice versa.
But it is not needed with PoS consensus, since the block interval is determined in PoS and there is already a timer to stop packing for too long.
Example
None
Changes
Remove unused worker code for BSC.