Suppose users on an exchange deposit bitcoin to different addresses using the HD wallet structure. Now suppose a user wants to withdraw bitcoin to an external address.
How would this whole process be done behind the scenes? I'm assuming the following happens:
A new address is generated for each deposit. Also, one address stores coins up to a certain amount, and the rest gets transferred into a cold wallet. This is done by making a transaction to this address when a deposit happens as long as the address contains bitcoin under some threshold. Then when withdrawals occur, only that address gets topped up and withdrawn from. This makes it easy to know which address contains coins that can be withdrawn from, and this address will contain a large enough amount of bitcoin so multiple transactions across different addresses aren't needed for a withdrawal.
Is this what happens in practice?