A user reported to me that they are unable to create a PSBT with a legacy watchonly wallet when they use the GUI. They get an error "The amount exceeds your balance".

I think the issue is that the GUI will retrieve the wallet's balance via `AvailableCoins` before calling `CreateTransaction`. This call to `AvailableCoins` is resulting in fewer coins being returned with recent changes to how `AvailableCoins` works, particularly with additional filtering of spendable coins and preset coins.

***

Note that this does not effect descriptor wallets. A workaround for this issue is to switch to using descriptor wallets. An existing legacy wallet can be turned into a descriptor wallet using the `migratewallet` RPC. However many watchonly legacy wallets are likely the result of importing descriptors via `importmulti`. For such wallets, I recommend creating a new descriptor wallet and re-importing the descriptors.
/**
 * Select all coins from coin_control, and if coin_control 'm_allow_other_inputs=true', call 'AutomaticCoinSelection' to
 * select a set of coins such that nTargetValue - pre_set_inputs.total_amount is met.
 */
util::Result<SelectionResult> SelectCoins(const CWallet& wallet, CoinsResult& available_coins, const PreSelectedInputs& pre_set_inputs,
                                          const CAmount& nTargetValue, const CCoinControl& coin_control,
                                          const CoinSelectionParams& coin_selection_params) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet);
struct CreatedTransactionResult
{
    CTransactionRef tx;
    CAmount fee;
    FeeCalculation fee_calc;
    int change_pos;
    CreatedTransactionResult(CTransactionRef _tx, CAmount _fee, int _change_pos, const FeeCalculation& _fee_calc)
        : tx(_tx), fee(_fee), fee_calc(_fee_calc), change_pos(_change_pos) {}
};
/**
 * Create a new transaction paying the recipients with a set of coins
 * selected by SelectCoins(); Also create the change output, when needed
 * @note passing change_pos as -1 will result in setting a random position
 */
util::Result<CreatedTransactionResult> CreateTransaction(CWallet& wallet, const std::vector<CRecipient>& vecSend, int change_pos, const CCoinControl& coin_control, bool sign = true);
/**
 * Insert additional inputs into the transaction by
 * calling CreateTransaction();
 */
bool FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& nFeeRet, int& nChangePosInOut, bilingual_str& error, bool lockUnspents, const std::set<int>& setSubtractFeeFromOutputs, CCoinControl);
} 
#endif