From 1d09dbd875ada6eabdd5b53fcae1cb219f0f5224 Mon Sep 17 00:00:00 2001 From: Vitaly Drogan Date: Fri, 11 Aug 2023 11:50:07 +0300 Subject: [PATCH] mark txs signed by builder as known txs (#97) --- miner/worker.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/miner/worker.go b/miner/worker.go index 64dd84f0de..d9fb0e465b 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -1547,11 +1547,22 @@ func (w *worker) generateWork(params *generateParams) (*types.Block, *big.Int, e orderCloseTime := time.Now() blockBundles, allBundles, usedSbundles, mempoolTxHashes, err := w.fillTransactionsSelectAlgo(nil, work) - if err != nil { return nil, nil, err } + // We mark transactions created by the builder as mempool transactions so code validating bundles will not fail + // for transactions created by the builder such as mev share refunds. + for _, tx := range work.txs { + from, err := types.Sender(work.signer, tx) + if err != nil { + return nil, nil, err + } + if from == work.coinbase { + mempoolTxHashes[tx.Hash()] = struct{}{} + } + } + err = VerifyBundlesAtomicity(work, blockBundles, allBundles, usedSbundles, mempoolTxHashes) if err != nil { log.Error("Bundle invariant is violated for built block", "block", work.header.Number, "err", err)