code: func (v *TxValidator) checkTxIdDupsLedger(tIdx int, chdr *common.ChannelHeader, ldgr ledger.PeerLedger) (errorTuple *blockValidationResult) {
  
  	// Retrieve the transaction identifier of the input header
  	txID := chdr.TxId
  
  	// Look for a transaction with the same identifier inside the ledger
  	_, err := ldgr.GetTransactionByID(txID)
  
  	// if returned error is nil, it means that there is already a tx in
  	// the ledger with the supplied id
  	if err == nil {
  		logger.Error("Duplicate transaction found, ", txID, ", skipping")
  		return &blockValidationResult{
  			tIdx:           tIdx,
  			validationCode: peer.TxValidationCode_DUPLICATE_TXID,
  		}
  	}
  
  	// if returned error is not of type blkstorage.NotFoundInIndexErr, it means
  	// we could not verify whether a tx with the supplied id is in the ledger
  	if _, isNotFoundInIndexErrType := err.(ledger.NotFoundInIndexErr); !isNotFoundInIndexErrType {
  		logger.Errorf("Ledger failure while attempting to detect duplicate status for "+
  			"txid %s, err '%s'. Aborting", txID, err)
  		return &blockValidationResult{
  			tIdx: tIdx,
  			err:  err,
  		}
  	}
  
  	// it otherwise means that there is no transaction with the same identifier
  	// residing in the ledger
  	return nil
  }
docs: // CheckTxIdDupsLedger returns a vlockValidationResult enhanced with the respective
  // error codes if and only if there is transaction with the same transaction identifier
  // in the ledger or no decision can be made for whether such transaction exists;
  // the function returns nil if it has ensured that there is no such duplicate, such
  // that its consumer can proceed with the transaction processing