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
CInputCoin input_coin = output.GetInputCoin();
            
            OutputGroup group{coin_sel_params};
            group.Insert(input_coin, output.nDepth, CachedTxIsFromMe(wallet, *output.tx, ISMINE_ALL), ancestors, descendants, positive_only);
            
            if (positive_only && group.GetSelectionAmount() <= 0) continue;
            if (group.m_outputs.size() > 0 && group.EligibleForSpending(filter)) groups_out.push_back(group);
        }
        return groups_out;
    }
    
    
    
    
    
    
    std::map<CScript, std::vector<OutputGroup>> spk_to_groups_map;
    for (const auto& output : outputs) {
        
        if (!output.fSpendable) continue;
        size_t ancestors, descendants;
        wallet.chain().getTransactionAncestry(output.tx->GetHash(), ancestors, descendants);
        CInputCoin input_coin = output.GetInputCoin();
        CScript spk = input_coin.txout.scriptPubKey;
        std::vector<OutputGroup>& groups = spk_to_groups_map[spk];
        if (groups.size() == 0) {
            
            groups.emplace_back(coin_sel_params);
        }