So, let's say you have a wallet with 20BTC, and you have a flow like so:
- You send 15BTC to A in block 1
- You send 15BTC to B in block 2
What happens if at block 1 there are two chains across miners. In chain X the transaction is there, in chain Y, the transaction is not there.
When they go to spend the other 15BTC in block 2 and their wallet(imagine a different computer using the same wallet) is on chain Y, then their wallet will let them do it. What happens when:
- Chain X becomes the dominant chain ** Transaction 1 would have confirmed, so would transaction 2 have been rejected and never confirm?
- Chain Y becomes the dominant chain ** Transaction 2 would have confirmed, so would transaction 1 be rejected and never confirm?
How is this represented in the bitcoin software even? I know there are some transactions that can be broadcast but then never confirmed, but how does the wallet know the money is not spend if it's been broadcast?