I am new to bitcoin so please bear my question. To understand the IN's and OUT's of this crypto world, i am creating a dummy bank to have a better understanding of the system.
So I have a bitcoin core running in my local system. Now for each user in the system I create an account for them using the getaccountaddress
.
So let us consider I have one account named A having a deposit of 10 BTC. Now, suppose the user A wish to withdraw 1BTC from his account so, I first find all unspent transactions filter it by address associated by account A and send this 1BTC to user A. Now as I understand that the bitcoin cannot be partially spent so the remaining change will go to a change address so I provided account A's address from which the transaction was created.
Now my problem is that if the user again wishes to withdraw, I cannot find any unspent transaction since the change is not yet received immediately and will only be available when the transaction is confirmed. So what is better way to handle this? What is a typical standard to handle such situation? How does wallet like Electrum works as I can see that I can send multiple transactions one after another.