Skip to content

Commit 4021359

Browse files
authored
Update miner挖矿部分源码分析CPU挖矿.md
1 parent a61d5ca commit 4021359

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

miner挖矿部分源码分析CPU挖矿.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,15 @@ commitTransactions
720720
var coalescedLogs []*types.Log
721721

722722
for {
723+
// If we don't have enough gas for any further transactions then we're done
724+
// 如果当前区块中所有 Gas 消耗已经使用完,则退出打包交易
725+
if env.gasPool.Gas() < params.TxGas {
726+
log.Trace("Not enough gas for further transactions", "have", env.gasPool, "want", params.TxGas)
727+
break
728+
}
729+
723730
// Retrieve the next transaction and abort if all done
731+
// 检索下一笔交易,如果交易集合为空则退出 commit
724732
tx := txs.Peek()
725733
if tx == nil {
726734
break

0 commit comments

Comments
 (0)