Skip to content

Commit

Permalink
upstream: more code review fix (ethereum#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
buddh0 authored Mar 11, 2024
1 parent 270793f commit 8ef781a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cmd/geth/pruneblock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var (
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
address = crypto.PubkeyToAddress(key.PublicKey)
balance = big.NewInt(100000000000000000)
gspec = &core.Genesis{Config: params.TestChainConfig, Alloc: core.GenesisAlloc{address: {Balance: balance}}, BaseFee: big.NewInt(params.InitialBaseFee)}
gspec = &core.Genesis{Config: params.TestChainConfig, Alloc: types.GenesisAlloc{address: {Balance: balance}}, BaseFee: big.NewInt(params.InitialBaseFee)}
signer = types.LatestSigner(gspec.Config)
config = &core.CacheConfig{
TrieCleanLimit: 256,
Expand Down
2 changes: 1 addition & 1 deletion core/eip3529tests/eip3529_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestGasUsage(t *testing.T, config *params.ChainConfig, engine consensus.Eng
balanceBefore = big.NewInt(1000000000000000)
gspec = &core.Genesis{
Config: config,
Alloc: core.GenesisAlloc{
Alloc: types.GenesisAlloc{
address: {Balance: balanceBefore},
aa: {
Code: bytecode,
Expand Down
2 changes: 1 addition & 1 deletion core/vote/vote_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func testVotePool(t *testing.T, isValidRules bool) {

genesis := &core.Genesis{
Config: params.TestChainConfig,
Alloc: core.GenesisAlloc{testAddr: {Balance: big.NewInt(1000000)}},
Alloc: types.GenesisAlloc{testAddr: {Balance: big.NewInt(1000000)}},
}

mux := new(event.TypeMux)
Expand Down
2 changes: 1 addition & 1 deletion eth/protocols/trust/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func newTestBackendWithGenerator(blocks int) *testBackend {
genspec := &core.Genesis{
Config: params.AllCliqueProtocolChanges,
ExtraData: make([]byte, 32+common.AddressLength+65),
Alloc: core.GenesisAlloc{testAddr: {Balance: big.NewInt(100000000000000000)}},
Alloc: types.GenesisAlloc{testAddr: {Balance: big.NewInt(100000000000000000)}},
BaseFee: big.NewInt(0),
}
copy(genspec.ExtraData[32:], testAddr[:])
Expand Down
22 changes: 11 additions & 11 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,17 @@ LOOP:
signal = commitInterruptOutOfGas
break
}
if stopTimer != nil {
select {
case <-stopTimer.C:
log.Info("Not enough time for further transactions", "txs", len(env.txs))
stopTimer.Reset(0) // re-active the timer, in case it will be used later.
signal = commitInterruptTimeout
break LOOP
default:
}
}

// If we don't have enough blob space for any further blob transactions,
// skip that list altogether
if !blobTxs.Empty() && env.blobs*params.BlobTxBlobGasPerBlob >= params.MaxBlobGasPerBlock {
Expand Down Expand Up @@ -850,17 +861,6 @@ LOOP:
break
}

if stopTimer != nil {
select {
case <-stopTimer.C:
log.Info("Not enough time for further transactions", "txs", len(env.txs))
stopTimer.Reset(0) // re-active the timer, in case it will be used later.
signal = commitInterruptTimeout
break LOOP
default:
}
}

// If we don't have enough space for the next transaction, skip the account.
if env.gasPool.Gas() < ltx.Gas {
log.Trace("Not enough gas left for transaction", "hash", ltx.Hash, "left", env.gasPool.Gas(), "needed", ltx.Gas)
Expand Down

0 comments on commit 8ef781a

Please sign in to comment.