@@ -13,6 +13,7 @@ import (
13
13
"time"
14
14
15
15
"github.com/golang/protobuf/proto"
16
+ "github.com/hyperledger/fabric/common/channelconfig"
16
17
vsccErrors "github.com/hyperledger/fabric/common/errors"
17
18
commonutil "github.com/hyperledger/fabric/common/util"
18
19
"github.com/hyperledger/fabric/core/committer"
@@ -116,12 +117,12 @@ type Fetcher interface {
116
117
fetch (dig2src dig2sources ) (* privdatacommon.FetchedPvtDataContainer , error )
117
118
}
118
119
119
- //go:generate mockery -dir ./ -name AppCapabilities -case underscore -output mocks/
120
- // AppCapabilities defines the capabilities for the application portion of a channel
121
- type AppCapabilities interface {
122
- // StorePvtDataOfInvalidTx() returns true if the peer needs to store the pvtData of
123
- // invalid transactions.
124
- StorePvtDataOfInvalidTx () bool
120
+ //go:generate mockery -dir ./ -name CapabilityProvider -case underscore -output mocks/
121
+
122
+ // CapabilityProvider contains functions to retrieve capability information for a channel
123
+ type CapabilityProvider interface {
124
+ // Capabilities defines the capabilities for the application portion of this channel
125
+ Capabilities () channelconfig. ApplicationCapabilities
125
126
}
126
127
127
128
// Support encapsulates set of interfaces to
@@ -133,7 +134,7 @@ type Support struct {
133
134
committer.Committer
134
135
TransientStore
135
136
Fetcher
136
- AppCapabilities
137
+ CapabilityProvider
137
138
}
138
139
139
140
type coordinator struct {
@@ -716,7 +717,8 @@ func (c *coordinator) listMissingPrivateData(block *common.Block, ownedRWsets ma
716
717
privateRWsetsInBlock : privateRWsetsInBlock ,
717
718
coordinator : c ,
718
719
}
719
- txList , err := data .forEachTxn (c .Support .StorePvtDataOfInvalidTx (), txsFilter , bi .inspectTransaction )
720
+ storePvtDataOfInvalidTx := c .Support .CapabilityProvider .Capabilities ().StorePvtDataOfInvalidTx ()
721
+ txList , err := data .forEachTxn (storePvtDataOfInvalidTx , txsFilter , bi .inspectTransaction )
720
722
if err != nil {
721
723
return nil , err
722
724
}
@@ -893,7 +895,8 @@ func (c *coordinator) GetPvtDataAndBlockByNum(seqNum uint64, peerAuthInfo protou
893
895
894
896
seqs2Namespaces := aggregatedCollections (make (map [seqAndDataModel ]map [string ][]* rwset.CollectionPvtReadWriteSet ))
895
897
data := blockData (blockAndPvtData .Block .Data .Data )
896
- data .forEachTxn (c .Support .StorePvtDataOfInvalidTx (), make (txValidationFlags , len (data )),
898
+ storePvtDataOfInvalidTx := c .Support .CapabilityProvider .Capabilities ().StorePvtDataOfInvalidTx ()
899
+ data .forEachTxn (storePvtDataOfInvalidTx , make (txValidationFlags , len (data )),
897
900
func (seqInBlock uint64 , chdr * common.ChannelHeader , txRWSet * rwsetutil.TxRwSet , _ []* peer.Endorsement ) error {
898
901
item , exists := blockAndPvtData .PvtData [seqInBlock ]
899
902
if ! exists {
0 commit comments