I have a doubt about how the Blockchain system avoids transactions to be lost.
Let me use an easy example:
Let's say there are only 2 mining pools (A and B), which are both trying to find a hash for block 5 to add it to the chain.
Now, A's block 5 can differ from B's block 5 in terms of transactions. E.g. the transaction "Alice buys a coffee for 5 BTC" can be in the block 5 for pool A, but not in block 5 for pool B (e.g. because this transaction arrived later to the node B compared to the node A).
Now, if the winning node for this block is the node B, the transaction "Alice...." won't be stamped in the ledger.
When the competition for the block 5 is over, are the "losing" pools/nodes (in this case the pool A) dropping all the transactions in the block they were working on? and take new transactions from the memory pool?
In this case, if the pools A and B start looking for block 6's hash, the transaction "Alice...." could be in block 6 for pool B, but it WON'T be in block 6 for pool A (pool A dropped this transaction when loosing the "race" for hashing block 5).
What if node A hashes block 6 before B? Now B will drop the transaction in its block 6, so the transaction "Alice...." is disappeared definitely.
Please correct me