I’m bumping the previous post coz it looks like I have some strange things going on in ppcd probably related to it, like some rejected blocks because already existing and so.
Please [member=30141]sigmike[/member] and [member=79]Sunny King[/member], thanx for your answers.
If you rejected a valid block for duplicate stake, your “supposed” best chain will get invalidated some time in the future. Meanwhile all the following valid blocks are getting orphaned. To re-attach the valid orphaned blocks to the main chain, you will have to refetch the dup-stake block you rejected, and it is the parent of the oldest orphan block you have.
Did I get it right? You can just say yes or no
Hard to test coz I still haven’t met such a dup-stake rejected block yet in testnet. I guess it might get impacted by sigmike solution for handling nothing-at-stake (both blocks would get rejected).
Any way, still need to find out for the others few lines of code.
If you rejected a valid block for duplicate stake, your “supposed” best chain will get invalidated some time in the future. Meanwhile all the following valid blocks are getting orphaned. To re-attach the valid orphaned blocks to the main chain, you will have to refetch the dup-stake block you rejected, and it is the parent of the oldest orphan block you have.
Did I get it right? You can just say yes or no ;)[/quote]
I’m not certain about the reasoning behind it but yes, all this code does it to ask explicitly for the parent of the oldest block in the orphan chain.
During initial download Peercoin uses the last Proof of Work block as reference because Proof of Stake blocks are ignored if the CoinStake input is not found. So when you receive a recent Proof of Stake block you don’t store it as orphan and the download process fails. That’s something we had to fix in Peershares:
This is probably to make the download process continue after the latest Proof of Work block has been received (because it’s the one used as reference, so the downloading peer doesn’t know anything about the following Proof of Stake blocks).