dir : miner/worker.go
chain head 혹은 특정 parent 기반으로 주어진 파라미터를 이용해 sealing task 생성
이 과정에서는 pending tx를 추가하지는 않고 빈 task 인스턴스 (type : environment)를 반환한다.
work, err := w.prepareWork(params)
tx가 있다면 이를 채워넣는다.
if !params.noTxs {
// ...
err := w.fillTransactions(interrupt, work)
}
합의 엔진을 이용해 block을 생성한다.
block, err := w.engine.FinalizeAndAssemble(w.chain, work.header, work.state, work.txs, work.unclelist(), work.receipts)
생성된 block, block에 대한 gas fee 반환
return block, totalFees(block, work.receipts), nil
miner.mainLoop()