find a CTransaction from a prevout in Bitcoin source code
I think what you want is to use this function:

bool CCoinsViewMemPool::GetCoin(const COutPoint &amp;outpoint, Coin &amp;coin) const

You can find the definition here: https://github.com/bitcoin/bitcoin/blob/v0.17.0.1/src/txmempool.cpp#L885

It will set the Coin object you pass as an argument. For an example of usage, see bool CheckSequenceLocks(const CTransaction &amp;tx, int flags, LockPoints* lp, bool useExistingLockPoints) in https://github.com/bitcoin/bitcoin/blob/v0.17.0.1/src/validation.cpp#L364

This is supposed to "provide access to all Coins which are either unspent in the
 * base CCoinsView, or are outputs from any mempool transaction".