This would allow wallet operations like funding transactions with smart contract-based inputs such as LN, or any input the Core wallet doesn't know how to sign for.

https://github.com/bitcoin/bitcoin/pull/17211#issuecomment-933674310
std::vector<COutput> vAvailableCoins;
    AvailableCoins(wallet, vAvailableCoins, &coin_control, 1, MAX_MONEY, MAX_MONEY, 0);
    
    std::optional<SelectionResult> result = SelectCoins(wallet, vAvailableCoins,  selection_target, coin_control, coin_selection_params);
    if (!result) {
        error = _("Insufficient funds");
        return false;
    }
    
    
    const CAmount change_and_fee = result->GetSelectedValue() - recipients_sum;
    assert(change_and_fee >= 0);
    CTxOut newTxOut(change_and_fee, scriptChange);
    if (nChangePosInOut == -1)
    {
        
        nChangePosInOut = GetRandInt(txNew.vout.size()+1);
    }
    else if ((unsigned int)nChangePosInOut > txNew.vout.size())
    {
        error = _("Change index out of range");
        return false;
    }
    assert(nChangePosInOut != -1);
    auto change_position = txNew.vout.insert(txNew.vout.begin() + nChangePosInOut, newTxOut);
    
    std::vector<CInputCoin> selected_coins = result->GetShuffledInputVector();