Skip to content

Commit

Permalink
increase same sender tx num to 10 in same block
Browse files Browse the repository at this point in the history
  • Loading branch information
Ji Qiren committed Mar 14, 2024
1 parent 37ad7c9 commit 75f31fb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions verifier/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@ func blockBaseExec(blk *block.Block, db database.IMultiValue, isolator *vm.Isola

// nolint:gocyclo
func baseGen(blk *block.Block, db database.IMultiValue, provider Provider, isolator *vm.Isolator, c *Config) (err error) {
blockTxLimit := 50
blockGasLimit := common.MaxBlockGasLimit
txLimitSameSender := 10
var tn time.Time
to := time.Now().Add(c.Timeout)
blockGasLimit := common.MaxBlockGasLimit

senderSet := map[string]struct{}{}
senderCount := make(map[string]int)
L:
for tn.Before(to) {
isolator.ClearTx()
Expand Down Expand Up @@ -157,11 +159,11 @@ L:
if t.GasLimit > blockGasLimit {
continue L
}
_, ok := senderSet[t.Publisher]
if ok {
thisSenderCount := senderCount[t.Publisher]
if thisSenderCount >= txLimitSameSender {
continue L
}
senderSet[t.Publisher] = struct{}{}
senderCount[t.Publisher] = thisSenderCount + 1
err := isolator.PrepareTx(t, limit)
if err != nil {
ilog.Errorf("PrepareTx failed. tx %v limit %v err %v", t.String(), limit, err)
Expand Down Expand Up @@ -194,7 +196,7 @@ L:
isolator.Commit()
blk.Txs = append(blk.Txs, t)
blk.Receipts = append(blk.Receipts, r)
if len(blk.Txs) >= 50 {
if len(blk.Txs) >= blockTxLimit {
break L
}
blockGasLimit -= r.GasUsage
Expand Down

0 comments on commit 75f31fb

Please sign in to comment.