I am looking at the source code and I want to know how a person can reject all blocks except the ones mined by himself? I want to be still able to add transaction to my blocks but reject all other mined blocks except mine, where do I need to look in the source code?
-
2This definitely sounds like an XY problem. Can you explain what you think that would accomplish?– David SchwartzCommented Jan 17, 2016 at 0:42
-
1@DavidSchwartz: I suppose you'd want this if you were going to mount a 51% attack.– Nate EldredgeCommented Jan 17, 2016 at 3:22
-
1Hardcode a checkpoint to a block you mined.– Murch ♦Commented Jan 17, 2016 at 3:43
-
It sounds like you do want to include transactions of others in your blockchain. Note that you will run into trouble with that as soon as the transaction has some ancestor that was a coin mined NOT on your chain.– JannesCommented Jan 19, 2016 at 13:53
Add a comment
|
1 Answer
I suspect that this is an instance of the XY problem, but I'll answer anyway.
If you modify ProcessMessage so that it drops any inbound block messages, that would do it.
Change
else if (strCommand == NetMsgType::BLOCK && !fImporting && !fReindex) // Ignore blocks received while importing
{
to
else if (false) // Ignore all blocks
{
-
I tried removing the whole block from ProcessMessage and it didn't work, I will try this and let you know.– mmitechCommented Jan 20, 2016 at 14:55