github.com/renegr87/renegr87@v2.1.1+incompatible/core/ledger/kvledger/txmgmt/validator/validator.go (about) 1 /* 2 Copyright IBM Corp. 2016 All Rights Reserved. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package validator 18 19 import ( 20 "github.com/hyperledger/fabric/core/ledger" 21 "github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/privacyenabledstate" 22 "github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/txmgr" 23 ) 24 25 // Validator validates the transactions present in a block and returns a batch that should be used to update the state 26 type Validator interface { 27 ValidateAndPrepareBatch(blockAndPvtdata *ledger.BlockAndPvtData, doMVCCValidation bool) ( 28 *privacyenabledstate.UpdateBatch, []*txmgr.TxStatInfo, error, 29 ) 30 } 31 32 // ErrPvtdataHashMissmatch is to be thrown if the hash of a collection present in the public read-write set 33 // does not match with the corresponding pvt data supplied with the block for validation 34 type ErrPvtdataHashMissmatch struct { 35 Msg string 36 } 37 38 func (e *ErrPvtdataHashMissmatch) Error() string { 39 return e.Msg 40 }