-snip- and what happens to the transaction included only in the block that loses? Do those transactions disappear completely or return to Memory pool.
In case the node initially followed a stale block and accepted the active chain, the node will check which transactions are already confirmed to be removed from its mempool.
Then, the ones that aren't included to the active chain but was included to the stale block will be re-included to its mempool.
(
take note that each node's mempool can be different)
I would appreciate an explanation of how this works in practice. Iam a newbie and I want to understand the process properly.
You'll love testnet4's blockchain for this.
Visualization of its forks:
fork.observer/?network=testnet4 (
you can zoom-in/out with your mouse wheel)
Imagine that the lines in that chart are the bitcoin nodes, some follow a fork and some follow the other
and once a block of the same height has more blocks on top of it, the other fork usually got stale.
Mainnet's blockchain isn't s chaotic as that, but it's a good example of what you're currently researching.