@@ -73,11 +73,6 @@ func (v *Validator) validateEndorserTX(envBytes []byte, doMVCCValidation bool, u
73
73
return txRWSet , txResult , err
74
74
}
75
75
76
- // TODO validate configuration transaction
77
- func (v * Validator ) validateConfigTX (env * common.Envelope ) (bool , error ) {
78
- return true , nil
79
- }
80
-
81
76
// ValidateAndPrepareBatch implements method in Validator interface
82
77
func (v * Validator ) ValidateAndPrepareBatch (block * common.Block , doMVCCValidation bool ) (* statedb.UpdateBatch , error ) {
83
78
logger .Debugf ("New block arrived for validation:%#v, doMVCCValidation=%t" , block , doMVCCValidation )
@@ -116,31 +111,27 @@ func (v *Validator) ValidateAndPrepareBatch(block *common.Block, doMVCCValidatio
116
111
return nil , err
117
112
}
118
113
119
- if common .HeaderType (chdr .Type ) == common .HeaderType_ENDORSER_TRANSACTION {
120
- txRWSet , txResult , err := v .validateEndorserTX (envBytes , doMVCCValidation , updates )
114
+ txType := common .HeaderType (chdr .Type )
121
115
122
- if err != nil {
123
- return nil , err
124
- }
116
+ if txType != common .HeaderType_ENDORSER_TRANSACTION {
117
+ logger .Debugf ("Skipping mvcc validation for Block [%d] Transaction index [%d] because, the transaction type is [%s]" ,
118
+ block .Header .Number , txIndex , txType )
119
+ continue
120
+ }
125
121
126
- txsFilter . SetFlag ( txIndex , txResult )
122
+ txRWSet , txResult , err := v . validateEndorserTX ( envBytes , doMVCCValidation , updates )
127
123
128
- //txRWSet != nil => t is valid
129
- if txRWSet != nil {
130
- committingTxHeight := version .NewHeight (block .Header .Number , uint64 (txIndex ))
131
- addWriteSetToBatch (txRWSet , committingTxHeight , updates )
132
- txsFilter .SetFlag (txIndex , peer .TxValidationCode_VALID )
133
- }
134
- } else if common .HeaderType (chdr .Type ) == common .HeaderType_CONFIG {
135
- _ , err := v .validateConfigTX (env )
124
+ if err != nil {
125
+ return nil , err
126
+ }
136
127
137
- if err != nil {
138
- return nil , err
139
- }
128
+ txsFilter .SetFlag (txIndex , txResult )
129
+
130
+ //txRWSet != nil => t is valid
131
+ if txRWSet != nil {
132
+ committingTxHeight := version .NewHeight (block .Header .Number , uint64 (txIndex ))
133
+ addWriteSetToBatch (txRWSet , committingTxHeight , updates )
140
134
txsFilter .SetFlag (txIndex , peer .TxValidationCode_VALID )
141
- } else {
142
- logger .Errorf ("Skipping transaction %d that's not an endorsement or configuration %d" , txIndex , chdr .Type )
143
- txsFilter .SetFlag (txIndex , peer .TxValidationCode_UNKNOWN_TX_TYPE )
144
135
}
145
136
146
137
if txsFilter .IsValid (txIndex ) {
@@ -150,7 +141,6 @@ func (v *Validator) ValidateAndPrepareBatch(block *common.Block, doMVCCValidatio
150
141
logger .Warningf ("Block [%d] Transaction index [%d] TxId [%s] marked as invalid by state validator. Reason code [%d]" ,
151
142
block .Header .Number , txIndex , chdr .TxId , txsFilter .Flag (txIndex ))
152
143
}
153
-
154
144
}
155
145
block .Metadata .Metadata [common .BlockMetadataIndex_TRANSACTIONS_FILTER ] = txsFilter
156
146
return updates , nil
0 commit comments