diff --git a/core/committer/txvalidator/txvalidator_test.go b/core/committer/txvalidator/txvalidator_test.go index 5589185ad21..a67cba4765c 100644 --- a/core/committer/txvalidator/txvalidator_test.go +++ b/core/committer/txvalidator/txvalidator_test.go @@ -81,27 +81,6 @@ func testValidationWithNTXes(t *testing.T, ledger ledger2.PeerLedger, gbHash []b for i := 0; i < nBlocks; i++ { assert.True(t, txsfltr.IsSetTo(i, peer.TxValidationCode_VALID)) } - - /* - - a better way of testing this without all of the mocking was - implemented in validator_test.go - - newMockVsccValidator := &validator.MockVsccValidator{ - CIns: upgradeChaincodeIns, - RespPayl: prespPaylBytes, - } - newTxValidator := &txValidator{&mocktxvalidator.Support{LedgerVal: ledger}, newMockVsccValidator} - - // generate new block - newBlock := testutil.ConstructBlock(t, 2, block.Header.Hash(), [][]byte{simRes}, true) // contains one tx with chaincode version v1 - - newTxValidator.Validate(newBlock) - - // tx should be invalided because of chaincode upgrade - txsfltr = util.TxValidationFlags(newBlock.Metadata.Metadata[common.BlockMetadataIndex_TRANSACTIONS_FILTER]) - assert.True(t, txsfltr.IsSetTo(0, peer.TxValidationCode_EXPIRED_CHAINCODE)) - */ } func TestDetectTXIdDuplicates(t *testing.T) { diff --git a/core/committer/txvalidator/validator.go b/core/committer/txvalidator/validator.go index 64cd4b2dc02..68bed6f497a 100644 --- a/core/committer/txvalidator/validator.go +++ b/core/committer/txvalidator/validator.go @@ -69,7 +69,7 @@ type Validator interface { // and vscc execution, in order to increase // testability of txValidator type vsccValidator interface { - VSCCValidateTx(payload *common.Payload, envBytes []byte, env *common.Envelope) (error, peer.TxValidationCode) + VSCCValidateTx(payload *common.Payload, envBytes []byte) (error, peer.TxValidationCode) } // vsccValidator implementation which used to call @@ -343,7 +343,7 @@ func validateTx(req *blockValidationRequest, results chan<- *blockValidationResu // Validate tx with vscc and policy logger.Debug("Validating transaction vscc tx validate") - err, cde := v.vscc.VSCCValidateTx(payload, d, env) + err, cde := v.vscc.VSCCValidateTx(payload, d) if err != nil { logger.Errorf("VSCCValidateTx for transaction txId = %s returned error: %s", txID, err) switch err.(type) { @@ -641,9 +641,9 @@ func (v *vsccValidatorImpl) txWritesToNamespace(ns *rwsetutil.NsRwSet) bool { return false } -func (v *vsccValidatorImpl) VSCCValidateTx(payload *common.Payload, envBytes []byte, env *common.Envelope) (error, peer.TxValidationCode) { - logger.Debugf("VSCCValidateTx starts for env %p envbytes %p", env, envBytes) - defer logger.Debugf("VSCCValidateTx completes for env %p envbytes %p", env, envBytes) +func (v *vsccValidatorImpl) VSCCValidateTx(payload *common.Payload, envBytes []byte) (error, peer.TxValidationCode) { + logger.Debugf("VSCCValidateTx starts for bytes %p", envBytes) + defer logger.Debugf("VSCCValidateTx completes env bytes %p", envBytes) // get header extensions so we have the chaincode ID hdrExt, err := utils.GetChaincodeHeaderExtension(payload.Header) diff --git a/core/mocks/validator/validator.go b/core/mocks/validator/validator.go index 926f4cbb930..0b18636f851 100644 --- a/core/mocks/validator/validator.go +++ b/core/mocks/validator/validator.go @@ -40,6 +40,6 @@ type MockVsccValidator struct { } // VSCCValidateTx does nothing -func (v *MockVsccValidator) VSCCValidateTx(payload *common.Payload, envBytes []byte, env *common.Envelope) (error, peer.TxValidationCode) { +func (v *MockVsccValidator) VSCCValidateTx(payload *common.Payload, envBytes []byte) (error, peer.TxValidationCode) { return nil, peer.TxValidationCode_VALID }