miner: include inclusion list transactions when building a payload

This commit is contained in:
Jihoon Song 2024-11-30 17:54:25 +09:00
parent aa3daf6109
commit 507e40a49b
1 changed files with 35 additions and 0 deletions

View File

@ -472,6 +472,41 @@ func (miner *Miner) fillTransactions(interrupt *atomic.Int32, env *environment)
return err
}
}
// Fill the block with transactions in the inclusion list that are not included in the block.
isIncluded := make(map[common.Hash]bool)
for _, txs := range pendingPlainTxs {
for _, tx := range txs {
isIncluded[tx.Hash] = true
}
}
for _, txs := range pendingBlobTxs {
for _, tx := range txs {
isIncluded[tx.Hash] = true
}
}
pendingInclusionListTxs := make([]*types.Transaction, 0)
for _, tx := range env.inclusionList {
if isIncluded[tx.Hash()] {
continue
}
pendingInclusionListTxs = append(pendingInclusionListTxs, tx)
}
if len(pendingInclusionListTxs) > 0 {
gasLimit := env.header.GasLimit
if env.gasPool == nil {
env.gasPool = new(core.GasPool).AddGas(gasLimit)
}
for _, tx := range pendingInclusionListTxs {
env.state.SetTxContext(tx.Hash(), env.tcount)
miner.commitTransaction(env, tx) // Error is simply ignored. A transaction that cannot be appended at the end of the block can be skipped.
}
}
return nil
}