Hi ZmnSCPxj,
>The proper response here is that Bob should broadcast success tx before the refund tx #1 becomes valid.
That's right. And even if Bob neglects to do that, it still won't cause chaos for Alice as long as she chooses the path for refund tx #2.
>at least part of the fund must be lost in fees and Bob can still suffer a small loss
Yes, after protocol completion Alice can broadcast one more transaction that is paid for by Bob, and Bob would have to respond with another transaction of his own. As you said, bring-your-own-fees would be better here (also see FAQ question "Can't Alice just publish the revoke_tx after protocol completion?").
>the server should take Alice position and the client should take Bob position [...] a client will want to make multiple CoinSwaps in sequence
I think this can be summarized as: whoever is planning to spend their UTXO first should be Bob.
In your protocol it might make sense for the server and client to swap roles depending on what the client plans to do. If they plan to swap again soon, they can be Bob, if they don't, they're Alice.
But there's also another consideration: whoever is less likely to abort the protocol should be Bob.
Clients can be unreliable. If clients are Bob, they can waste Alice's resources by initiating the protocol and aborting (which imo is more severe than the risk of the revoke tx getting published). Whereas if the client is Alice, she'd be first to commit resources before the server commits anything.
>ensure the txo is spent before refund tx #1 becoms valid
Yes, this is important. Luckily, pretty much all the options we discussed could be applied here, including sighash_singleĀ + anyonecanpay. In your specific example this seems preferable to adding a change output and making multiple transactions with different RBF amounts, especially since this only concerns a situation where the protocol stalls at a specific step (after the success tx).
And I agree with your general assessment that three transactions are required in order to pay a third party. This could be done from either side of the swap, but of course it makes more sense to pay from the timelock side and get rid of the online requirement.
Cheers,
Ruben