Skip to content

Commit

Permalink
Merge pull request #473 from qianbin/gaslimit-soft-limit
Browse files Browse the repository at this point in the history
cmd/thor: set soft limit for block gaslimit
  • Loading branch information
libotony authored Jul 14, 2021
2 parents 8eff2b2 + dd93fed commit 0fcf3a0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/thor/node/packer_loop.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import (
"github.com/vechain/thor/tx"
)

// gasLimitSoftLimit is the soft limit of the adaptive block gaslimit.
const gasLimitSoftLimit uint64 = 21000000

func (n *Node) packerLoop(ctx context.Context) {
log.Debug("enter packer loop")
defer log.Debug("leave packer loop")
Expand All @@ -43,6 +46,10 @@ func (n *Node) packerLoop(ctx context.Context) {
if n.targetGasLimit == 0 {
// no preset, use suggested
suggested := n.bandwidth.SuggestGasLimit()
// apply soft limit in adaptive mode
if suggested > gasLimitSoftLimit {
suggested = gasLimitSoftLimit
}
n.packer.SetTargetGasLimit(suggested)
}

Expand Down

0 comments on commit 0fcf3a0

Please sign in to comment.