github.com/iotexproject/iotex-core@v1.14.1-rc1/state/factory/minter.go (about)

     1  // Copyright (c) 2020 IoTeX Foundation
     2  // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
     3  // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
     4  // This source code is governed by Apache License 2.0 that can be found in the LICENSE file.
     5  
     6  package factory
     7  
     8  import (
     9  	"context"
    10  
    11  	"github.com/iotexproject/iotex-core/action"
    12  	"github.com/iotexproject/iotex-core/actpool"
    13  	"github.com/iotexproject/iotex-core/blockchain"
    14  	"github.com/iotexproject/iotex-core/blockchain/block"
    15  )
    16  
    17  type minter struct {
    18  	f  Factory
    19  	ap actpool.ActPool
    20  }
    21  
    22  // NewMinter creates a wrapper instance
    23  func NewMinter(f Factory, ap actpool.ActPool) blockchain.BlockBuilderFactory {
    24  	return &minter{f: f, ap: ap}
    25  }
    26  
    27  // NewBlockBuilder implements the BlockMinter interface
    28  func (m *minter) NewBlockBuilder(ctx context.Context, sign func(action.Envelope) (*action.SealedEnvelope, error)) (*block.Builder, error) {
    29  	return m.f.NewBlockBuilder(ctx, m.ap, sign)
    30  }