<p>I suspect that this is an instance of the <a href="http://xyproblem.info/" rel="nofollow">XY problem</a>, but I'll answer anyway.</p>

<p>If you modify <a href="https://github.com/bitcoin/bitcoin/blob/dd1304ec216c7d4bdb302195e184b15503819f67/src/main.cpp#L4233" rel="nofollow">ProcessMessage</a> so that it drops any inbound block messages, that would do it.</p>

<p>Change</p>

<pre><code>    else if (strCommand == NetMsgType::BLOCK &amp;&amp; !fImporting &amp;&amp; !fReindex) // Ignore blocks received while importing
    {
</code></pre>

<p>to</p>

<pre><code>    else if (false) // Ignore all blocks
    {
</code></pre>

CC BY-SA 3.0
2016-01-20T14:55:35.280Z
I tried removing the whole block from ProcessMessage and it didn't work, I will try this and let you know.
mmitech
CC BY-SA 3.0
2016-01-16T22:04:15.437Z
2016-01-16T22:04:15.437Z
Nick ODell
<p>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 <a href="https://github.com/bitcoin/bitcoin/tree/0.8" rel="nofollow">source code</a>?</p>

CC BY-SA 3.0
2016-01-17T00:42:09.637Z
This definitely sounds like an XY problem. Can you explain what you think that would accomplish?
David Schwartz
CC BY-SA 3.0
2016-01-17T03:22:22.267Z
@DavidSchwartz: I suppose you'd want this if you were going to mount a 51% attack.
Nate Eldredge
CC BY-SA 3.0
2016-01-17T03:43:38.030Z
Hardcode a checkpoint to a block you mined.
Murch
CC BY-SA 3.0
2016-01-19T13:53:17.107Z
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
<bitcoin-core-development><altcoin-development>
Reject all other Blocks and allow only my own mined blocks
mmitech
# Reject all other Blocks and allow only my own mined blocks

(Asked by: username_0 on 2016-01-16)

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](https://github.com/bitcoin/bitcoin/tree/0.8)?

**Tags:** bitcoin-core-development, altcoin-development

> **Comments:**
> **username_1**: This definitely sounds like an XY problem. Can you explain what you think that would accomplish?  
> **username_2**: @DavidSchwartz: I suppose you'd want this if you were going to mount a 51% attack.  
> **username_3**: Hardcode a checkpoint to a block you mined.  
> **username_4**: 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.  

---

## 1 answers

### Answer by username_5 on 2016-01-16. Score: 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
    {

> **Comments:**
> **username_0**: I tried removing the whole block from ProcessMessage and it didn't work, I will try this and let you know.  

---

