-
Notifications
You must be signed in to change notification settings - Fork 20k
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
miner: move agent logic to worker #17351
Conversation
5c01fa1
to
8ddee3f
Compare
8ddee3f
to
dc9c87e
Compare
miner/worker.go
Outdated
// worker is the main object which takes care of applying messages to the new state | ||
type worker struct { | ||
// Task contains all information for consensus engine sealing and result submitting. | ||
type Task struct { |
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.
Does this need to be public?
miner/worker.go
Outdated
|
||
// Worker is the main object which takes care of submitting new work to consensus engine | ||
// and gathering the sealing result. | ||
type Worker struct { |
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.
Similarly, does the worker need to be public?
miner/worker.go
Outdated
|
||
block := result.block |
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.
Nitpick, please move this back above the empty line. It's easier on the eye that the first core-block is "initialization" and then an empty line, then comment and continuation.
miner/worker.go
Outdated
// makeCurrent creates a new environment for the current cycle. | ||
func (self *worker) makeCurrent(parent *types.Block, header *types.Header) error { | ||
state, err := self.chain.StateAt(parent.Root()) | ||
// makeCurrent creates an new environment for the current cycle. |
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.
"an" -> "a"
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
* miner: move agent logic to worker * miner: polish * core: persist block before reorg
Refactor miner package a bit and fix some issues.
This PR includes:
ChainEvent
only when we insert a canonical block