Skip to content

Commit

Permalink
fix: ut
Browse files Browse the repository at this point in the history
  • Loading branch information
irrun committed Feb 15, 2024
1 parent 4a1b2b0 commit aa5817f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/geth/consolecmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
)

const (
ipcAPIs = "admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 parlia:1.0 rpc:1.0 txpool:1.0 web3:1.0"
ipcAPIs = "admin:1.0 debug:1.0 eth:1.0 mev:1.0 miner:1.0 net:1.0 parlia:1.0 rpc:1.0 txpool:1.0 web3:1.0"
httpAPIs = "eth:1.0 net:1.0 rpc:1.0 web3:1.0"
)

Expand Down
2 changes: 2 additions & 0 deletions miner/bid_simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ var (

type WorkPreparer interface {
prepareWork(params *generateParams) (*environment, error)
etherbase() common.Address
}

// simBidReq is the request for simulating a bid
Expand Down Expand Up @@ -539,6 +540,7 @@ func (b *bidSimulator) simBid(interruptCh chan int32, bidRuntime *BidRuntime) {
// prepareWork will start trie prefetching
if bidRuntime.env, err = b.workPreparer.prepareWork(&generateParams{
parentHash: bidRuntime.bid.ParentHash,
coinbase: b.workPreparer.etherbase(),
}); err != nil {
return
}
Expand Down
11 changes: 3 additions & 8 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -884,18 +884,13 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) {
}
timestamp = parent.Time + 1
}

coinbase := genParams.coinbase
if coinbase == (common.Address{}) {
coinbase = w.etherbase()
}
// Construct the sealing block header.
header := &types.Header{
ParentHash: parent.Hash(),
Number: new(big.Int).Add(parent.Number, common.Big1),
GasLimit: core.CalcGasLimit(parent.GasLimit, w.config.GasCeil),
Time: timestamp,
Coinbase: coinbase,
Coinbase: genParams.coinbase,
}
// Set the extra field.
if len(w.extra) != 0 {
Expand All @@ -921,7 +916,7 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) {
// Could potentially happen if starting to mine in an odd state.
// Note genParams.coinbase can be different with header.Coinbase
// since clique algorithm can modify the coinbase field in header.
env, err := w.makeEnv(parent, header, coinbase, genParams.prevWork)
env, err := w.makeEnv(parent, header, genParams.coinbase, genParams.prevWork)
if err != nil {
log.Error("Failed to create sealing context", "err", err)
return nil, err
Expand Down Expand Up @@ -1161,7 +1156,7 @@ LOOP:

// when out-turn, use bestWork to prevent bundle leakage.
// when in-turn, compare with remote work.
if bestWork.header.Difficulty.Cmp(diffInTurn) == 0 {
if w.bidFetcher != nil && bestWork.header.Difficulty.Cmp(diffInTurn) == 0 {
bestBid := w.bidFetcher.GetBestBid(bestWork.header.ParentHash)

if bestBid != nil && bestBid.packedBlockReward.Cmp(bestReward) > 0 {
Expand Down

0 comments on commit aa5817f

Please sign in to comment.