When my node realizes that the given block needs to be abandoned - does it leave it in the database or replace the block with a valid one?
It remains on disk along with its entry in the block index database.
And if "invalid" block remains: is it somehow marked as invalid?
Yes. The block index database contains an entry for each block which contains flags that indicate the state of the block. This includes various states of validity and invalidity (that indicate where it passed or failed certain checks).
If I meet two blocks with the same parent in the blockchain - how could I know which branch should I follow?
Your node will follow the valid chain with the most cumulative work. At a given difficulty, this is the longest chain, but that is not always the case. If there are two blocks that have the same cumulative work, the node chooses the one it saw first. Eventually there will be a resolution as one of those blocks will be mined on and so have a greater cumulative work.
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments