// containsTx reports whether the transaction with a certain hash
// is contained within the specified block.
554608
func containsTx(block *types.Block, hash common.Hash) bool {
	for _, tx := range block.Transactions() {
		if tx.Hash() == hash {
			return true
		}
	}
	return false
}
1323076
func contains(slice []string, entry string) bool {
	for _, element := range slice {
		if element == entry {
			return true
		}
	}
	return false
}
38235
func RetrieveTxnsBlocks(ctx context.Context, db *sql.DB, txHash string) (blockHashes []string,
	blockHeights, blockIndexes []uint32, areValid, areMainchain []bool, err error) {
	var rows *sql.Rows
	rows, err = db.QueryContext(ctx, internal.SelectTxsBlocks, txHash)
	if err != nil {
		return
	}
	defer closeRows(rows)

	for rows.Next() {
		var hash string
		var height, idx uint32
		var isValid, isMainchain bool
		err = rows.Scan(&height, &hash, &idx, &isValid, &isMainchain)
		if err != nil {
			break
		}

		blockHeights = append(blockHeights, height)
		blockHashes = append(blockHashes, hash)
		blockIndexes = append(blockIndexes, idx)
		areValid = append(areValid, isValid)
		areMainchain = append(areMainchain, isMainchain)
	}
	return
}
50197
func (lv *lockVerifier) Contains(name string) bool {
	if lv == nil {
		return false
	}
	_, ok := lv.theirLocks[name]
	return ok
}
27700
func (t *TSMReader) Contains(key []byte) bool {
	return t.index.Contains(key)
}
660096
func (f *PkgFilter) Contains(i uint16) bool {
	byt := i / 8
	bit := i % 8

	// Read the i-th bit in the filter.
	// TODO(conner): ignore if > count to prevent panic?
	return f.filter[byt]&(1<<(7-bit)) != 0
}
913343
func (a *Array) Contains(values ...interface{}) *Array {
	elements, ok := canonArray(&a.chain, values)
	if !ok {
		return a
	}
	for _, e := range elements {
		if !a.containsElement(e) {
			a.chain.fail("\nexpected array containing element:\n%s\n\nbut got:\n%s",
				dumpValue(e), dumpValue(a.value))
		}
	}
	return a
}
1048563
func (f *FST) Contains(val []byte) (bool, error) {
	_, exists, err := f.Get(val)
	return exists, err
}
947766
func (n *TxNotifier) filterTx(tx *btcutil.Tx, blockHash *chainhash.Hash,
	blockHeight uint32, onConf func(ConfRequest, *TxConfirmation),
	onSpend func(SpendRequest, *SpendDetail)) {

	// In order to determine if this transaction is relevant to the
	// notifier, we'll check its inputs for any outstanding spend
	// requests.
	txHash := tx.Hash()
	if onSpend != nil {
		// notifyDetails is a helper closure that will construct the
		// spend details of a request and hand them off to the onSpend
		// callback.
		notifyDetails := func(spendRequest SpendRequest,
			prevOut wire.OutPoint, inputIdx uint32) {

			Log.Debugf("Found spend of %v: spend_tx=%v, "+
				"block_height=%d", spendRequest, txHash,
				blockHeight)

			onSpend(spendRequest, &SpendDetail{
				SpentOutPoint:     &prevOut,
				SpenderTxHash:     txHash,
				SpendingTx:        tx.MsgTx(),
				SpenderInputIndex: inputIdx,
				SpendingHeight:    int32(blockHeight),
			})
		}

		for i, txIn := range tx.MsgTx().TxIn {
			// We'll re-derive the script of the output being spent
			// to determine if the inputs spends any registered
			// requests.
			prevOut := txIn.PreviousOutPoint
			pkScript, err := txscript.ComputePkScript(
				txIn.SignatureScript, txIn.Witness,
			)
			if err != nil {
				continue
			}
			spendRequest := SpendRequest{
				OutPoint: prevOut,
				PkScript: pkScript,
			}

			// If we have any, we'll record their spend height so
			// that notifications get dispatched to the respective
			// clients.
			if _, ok := n.spendNotifications[spendRequest]; ok {
				notifyDetails(spendRequest, prevOut, uint32(i))
			}
			spendRequest.OutPoint = ZeroOutPoint
			if _, ok := n.spendNotifications[spendRequest]; ok {
				notifyDetails(spendRequest, prevOut, uint32(i))
			}
		}
	}

	// We'll also check its outputs to determine if there are any
	// outstanding confirmation requests.
	if onConf != nil {
		// notifyDetails is a helper closure that will construct the
		// confirmation details of a request and hand them off to the
		// onConf callback.
		notifyDetails := func(confRequest ConfRequest) {
			Log.Debugf("Found initial confirmation of %v: "+
				"height=%d, hash=%v", confRequest,
				blockHeight, blockHash)

			details := &TxConfirmation{
				Tx:          tx.MsgTx(),
				BlockHash:   blockHash,
				BlockHeight: blockHeight,
				TxIndex:     uint32(tx.Index()),
			}

			onConf(confRequest, details)
		}

		for _, txOut := range tx.MsgTx().TxOut {
			// We'll parse the script of the output to determine if
			// we have any registered requests for it or the
			// transaction itself.
			pkScript, err := txscript.ParsePkScript(txOut.PkScript)
			if err != nil {
				continue
			}
			confRequest := ConfRequest{
				TxID:     *txHash,
				PkScript: pkScript,
			}

			// If we have any, we'll record their confirmed height
			// so that notifications get dispatched when they
			// reaches the clients' desired number of confirmations.
			if _, ok := n.confNotifications[confRequest]; ok {
				notifyDetails(confRequest)
			}
			confRequest.TxID = ZeroHash
			if _, ok := n.confNotifications[confRequest]; ok {
				notifyDetails(confRequest)
			}
		}
	}
}
1947
func (r *Allocator) contains(label *mcs.Label) (bool, uint64) {
	return r.r.Offset(label)
}
218896
func (w *Wallet) Contains(account accounts.Account) bool {
	if pairing := w.Hub.pairing(w); pairing != nil {
		_, ok := pairing.Accounts[account.Address]
		return ok
	}
	return false
}
225061
func (r *Allocator) contains(block uid.Block) (bool, uint32) {
	return r.r.Offset(block)
}
198966
func (r SACKBlock) Contains(b SACKBlock) bool {
	return r.Start.LessThanEq(b.Start) && b.End.LessThanEq(r.End)
}
921372
func ReadTxLookupEntry(db ethdb.Reader, hash common.Hash) *uint64 {
	data, _ := db.Get(txLookupKey(hash))
	if len(data) == 0 {
		return nil
	}
	// Database v6 tx lookup just stores the block number
	if len(data) < common.HashLength {
		number := new(big.Int).SetBytes(data).Uint64()
		return &number
	}
	// Database v4-v5 tx lookup format just stores the hash
	if len(data) == common.HashLength {
		return ReadHeaderNumber(db, common.BytesToHash(data))
	}
	// Finally try database v3 tx lookup format
	var entry LegacyTxLookupEntry
	if err := rlp.DecodeBytes(data, &entry); err != nil {
		log.Error("Invalid transaction lookup entry RLP", "hash", hash, "blob", data, "err", err)
		return nil
	}
	return &entry.BlockIndex
}
867498
func ContainsAny(target string, strs []string) bool {
	for _, str := range strs {
		if strings.Contains(target, str) {
			return true
		}
	}
	return false
}
700464
func (s *OIDSet) Contains(oid *OID) bool {
	contains, _ := s.TestOIDSetMember(oid)
	return contains
}
1245858
func (db *TXDatabaseOverlay) GetTX(txid string) (interfaces.ITransaction, error) {
	txs, err := db.GetAllTXs()
	if err != nil {
		return nil, err
	}

	for _, tx := range txs {
		if tx.GetSigHash().String() == txid {
			return tx, nil
		}
	}

	return nil, fmt.Errorf("Transaction not found")
}