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?

4
  • 2
    This definitely sounds like an XY problem. Can you explain what you think that would accomplish? Commented Jan 17, 2016 at 0:42
  • 1
    @DavidSchwartz: I suppose you'd want this if you were going to mount a 51% attack. Commented Jan 17, 2016 at 3:22
  • 1
    Hardcode 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.
    – Jannes
    Commented Jan 19, 2016 at 13:53

1 Answer 1

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
    {
1
  • I tried removing the whole block from ProcessMessage and it didn't work, I will try this and let you know.
    – mmitech
    Commented Jan 20, 2016 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.