-
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
Parlia: Some updates of the miner worker #1182
Conversation
3b0f461
to
7832b73
Compare
Right now, DelayLeftOver is used to reserve time for block finalize, not block broadcast. And the code does not work as expected. The general block generation could be described as: |- fillTransactions -|- finalize a block -|- wait until the period(3s) reached -|- broadcast -|
7832b73
to
c80586c
Compare
6fab891
to
b903124
Compare
It could be a very old PoW logic, which try to add more transaction into the pending block when mining is stopped. Mining can be stopped when: 1.download started. 2.manually stopped by RPC. It is unnecessary to add more transaction into the pending block if a validator is stopped. And updateSnapshot() is not needed as well, it is to get the pending mining snapshot.
b903124
to
4c7f004
Compare
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
if len(localTxs) > 0 { | ||
txs := types.NewTransactionsByPriceAndNonce(env.signer, localTxs, env.header.BaseFee) | ||
if w.commitTransactions(env, txs, interruptCh) { | ||
if w.commitTransactions(env, txs, interruptCh, stopTimer) { |
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.
x := time.NewTimer(time.Second)
<-x.C
fmt.Println("read delay 1")
<-x.C
fmt.Println("read delay 2")
It turns out that fmt.Println("read delay 2")
is not reachable.
So if the timer trigger during the first commitTransactions
for local tx, then commitTransactions
will have no time delay limitation .
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.
yes, it do have the problem, will fix it later.
Description
Some update of the worker.go
1.Delay() with DelayLeftOver
Right now, DelayLeftOver is used to reserve time for block finalize, not block broadcast.
The general block generation could be described as:
|- fillTransactions -|- finalize a block -|- wait until the period(3s) reached -|- broadcast -|
And the code does not work as expected, some code improve on the Delay() logic.
2.no need to add transaction to the current work if mining is stopped.
It seems that it is unnecessary to add transaction when mining is stopped.
It is a old logic of PoW, which is no longer need for BSC.
Rationale
none
Example
none
Changes
none