github.com/xiaqingdoc/fabric@v2.1.1+incompatible/core/handlers/endorsement/testdata/noop_endorser.go (about)

     1  /*
     2  Copyright IBM Corp. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package main
     8  
     9  import (
    10  	"github.com/hyperledger/fabric-protos-go/peer"
    11  	endorsement "github.com/hyperledger/fabric/core/handlers/endorsement/api"
    12  )
    13  
    14  type NoOpEndorser struct {
    15  }
    16  
    17  func (*NoOpEndorser) Endorse(payload []byte, sp *peer.SignedProposal) (*peer.Endorsement, []byte, error) {
    18  	return nil, payload, nil
    19  }
    20  
    21  func (*NoOpEndorser) Init(dependencies ...endorsement.Dependency) error {
    22  	return nil
    23  }
    24  
    25  type NoOpEndorserFactory struct {
    26  }
    27  
    28  func (*NoOpEndorserFactory) New() endorsement.Plugin {
    29  	return &NoOpEndorser{}
    30  }
    31  
    32  // NewPluginFactory is the function ran by the plugin infrastructure to create an endorsement plugin factory.
    33  func NewPluginFactory() endorsement.PluginFactory {
    34  	return &NoOpEndorserFactory{}
    35  }