Skip to content

Commit

Permalink
Remove targetBlockSize arg (#3249)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph authored Jul 30, 2024
1 parent 809081e commit fdd4693
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
13 changes: 7 additions & 6 deletions vms/platformvm/block/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"errors"
"fmt"
"math"
"sync"
"time"

Expand Down Expand Up @@ -61,12 +62,12 @@ type Builder interface {
// BuildBlock can be called to attempt to create a new block
BuildBlock(context.Context) (snowman.Block, error)

// PackBlockTxs returns an array of txs that can fit into a valid block of
// size [targetBlockSize]. The returned txs are all verified against the
// preferred state.
// PackAllBlockTxs returns an array of all txs that could be packed into a
// valid block of infinite size. The returned txs are all verified against
// the preferred state.
//
// Note: This function does not call the consensus engine.
PackBlockTxs(targetBlockSize int) ([]*txs.Tx, error)
PackAllBlockTxs() ([]*txs.Tx, error)
}

// builder implements a simple builder to convert txs into valid blocks
Expand Down Expand Up @@ -236,7 +237,7 @@ func (b *builder) BuildBlock(context.Context) (snowman.Block, error) {
return b.blkManager.NewBlock(statelessBlk), nil
}

func (b *builder) PackBlockTxs(targetBlockSize int) ([]*txs.Tx, error) {
func (b *builder) PackAllBlockTxs() ([]*txs.Tx, error) {
preferredID := b.blkManager.Preferred()
preferredState, ok := b.blkManager.GetState(preferredID)
if !ok {
Expand All @@ -250,7 +251,7 @@ func (b *builder) PackBlockTxs(targetBlockSize int) ([]*txs.Tx, error) {
b.txExecutorBackend,
b.blkManager,
b.txExecutorBackend.Clk.Time(),
targetBlockSize,
math.MaxInt,
)
}

Expand Down
3 changes: 1 addition & 2 deletions vms/platformvm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"errors"
"fmt"
"math"
"net/http"
"time"

Expand Down Expand Up @@ -269,7 +268,7 @@ func (vm *VM) pruneMempool() error {
// Packing all of the transactions in order performs additional checks that
// the MempoolTxVerifier doesn't include. So, evicting transactions from
// here is expected to happen occasionally.
blockTxs, err := vm.Builder.PackBlockTxs(math.MaxInt)
blockTxs, err := vm.Builder.PackAllBlockTxs()
if err != nil {
return err
}
Expand Down

0 comments on commit fdd4693

Please sign in to comment.