Skip to content

Commit

Permalink
combine two loops into one to add txes to block in simulated backend …
Browse files Browse the repository at this point in the history
…chain
  • Loading branch information
susannapaxos committed Sep 3, 2021
1 parent 16470f5 commit 8cc712d
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,7 @@ func (b *SimulatedBackend) Commit() {

blocks, _ := core.GenerateChain(b.config, parentBlock, ethash.NewFaker(), b.database, 1,
func(number int, block *core.BlockGen) {

for _, tx := range b.pendingBlock.Transactions() {
if b.marketGasPrice == nil || b.marketGasPrice.Cmp(tx.GasPrice()) <= 0 {
block.AddTxWithChain(b.blockchain, tx)
} else {
remainingTx = append(remainingTx, tx)
}
}

for _, tx := range b.stuckTransactions {
for _, tx := range append(b.pendingBlock.Transactions(), b.stuckTransactions...) {
if b.marketGasPrice == nil || b.marketGasPrice.Cmp(tx.GasPrice()) <= 0 {
block.AddTxWithChain(b.blockchain, tx)
} else {
Expand Down

0 comments on commit 8cc712d

Please sign in to comment.