Reject all other Blocks and allow only my own mined blocks

0

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?

mmitech

Posted 2016-01-16T19:36:46.140

Reputation: 1

2This definitely sounds like an XY problem. Can you explain what you think that would accomplish?David Schwartz 2016-01-17T00:42:09.637

1@DavidSchwartz: I suppose you'd want this if you were going to mount a 51% attack.Nate Eldredge 2016-01-17T03:22:22.267

1Hardcode a checkpoint to a block you mined.Murch 2016-01-17T03:43:38.030

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.Jannes 2016-01-19T13:53:17.107

Answers

1

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
    {

Nick ODell

Posted 2016-01-16T19:36:46.140

Reputation: 26 536

I tried removing the whole block from ProcessMessage and it didn't work, I will try this and let you know.mmitech 2016-01-20T14:55:35.280