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
}
            CMutableTransaction rawTx = ConstructTransaction(options["inputs"], request.params[0], options["locktime"], rbf);
            CCoinControl coin_control;
            
            
            coin_control.m_add_inputs = rawTx.vin.size() == 0;
            FundTransaction(*pwallet, rawTx, fee, change_position, options, coin_control,  false);
            bool add_to_wallet = true;
            if (options.exists("add_to_wallet")) {
                add_to_wallet = options["add_to_wallet"].get_bool();
            }
            
            PartiallySignedTransaction psbtx(rawTx);
            
            
            bool complete;
            pwallet->FillPSBT(psbtx, complete, SIGHASH_DEFAULT, false, true);
            const TransactionError err = pwallet->FillPSBT(psbtx, complete, SIGHASH_DEFAULT, true, false);
            if (err != TransactionError::OK) {
                throw JSONRPCTransactionError(err);
            }
            CMutableTransaction mtx;
            complete = FinalizeAndExtractPSBT(psbtx, mtx);
            UniValue result(UniValue::VOBJ);
            if (psbt_opt_in || !complete || !add_to_wallet) {
                
                CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
                ssTx << psbtx;
                result.pushKV("psbt", EncodeBase64(ssTx.str()));
            }