<p>It looks like this part of the code is what was adding all those UpdateTip messages:</p>

<p><a href="https://github.com/bitcoin/bitcoin/blob/8fe30fb4d130532d4a0e4c9d143f03e1b85a749e/src/main.cpp#L2234" rel="nofollow">https://github.com/bitcoin/bitcoin/blob/8fe30fb4d130532d4a0e4c9d143f03e1b85a749e/src/main.cpp#L2234</a></p>

<p>Essentially, bitcoind thinks another chain with more cumulative work exists on your 4-node network, though from the logs, it's hard to tell how much lower it goes. You'll have to run it for longer in order to find out.</p>

CC BY-SA 3.0
2015-11-05T02:33:50.107Z
Oh so you mean this is the case of switching between two competing blockchains ?
bawejakunal
CC BY-SA 3.0
2015-11-05T15:16:51.837Z
Yes. This could happen if, for example, one of your nodes wasn't receiving blocks, only sending them.
Jimmy Song
CC BY-SA 3.0
2015-11-05T00:09:01.750Z
2015-11-05T00:09:01.750Z
Jimmy Song
<p>I am running a private bitcoin network for which I changed the target time between two blocks to <code>12 seconds</code> and the difficulty adjustment to <code>25 blocks</code> interval. I ran the network for about 4 hours with 50 nodes. In one of the node's logs I observed that the blockchain height increased up to a maximum of 181 and then started decreasing, all the way to 38. what could be an explanation for such a strange behaviour.</p>

<p>Please refer to the log below:</p>

<pre><code>2015-11-04 01:58:47 receive version message: /Satoshi:0.11.99/: version 70011, blocks=181, us=0.0.0.0:0, peer=2, peeraddr=127.0.0.1:44117
2015-11-04 01:58:47 UpdateTip: new best=0000005265ca4ce01ad0d06f45cf475bf303de3d64e942c5cf1177e00f346c78  height=180  log2_work=37.083283  tx=30941  date=2015-11-04 01:53:17 progress=1.000000  cache=0.0MiB(1tx)
2015-11-04 01:58:47 UpdateTip: new best=00000052a34cedf3c5ddbeb46d36644654523db855c4cce984d2623e840dd219  height=179  log2_work=37.082953  tx=30940  date=2015-11-04 01:53:10 progress=1.000000  cache=0.0MiB(2tx)
2015-11-04 01:58:47 UpdateTip: new best=00000030fd7652affb883f05fe0c98e7fe3fbc3cfd74808e061ed05ec61c22e6  height=178  log2_work=37.082623  tx=30939  date=2015-11-04 01:52:55 progress=1.000000  cache=0.0MiB(3tx)
2015-11-04 01:58:47 AddToWallet c32bcbd8102c602a5e71ee717232e204435f331dce6fbfb9eb5d552698faa95b
2015-11-04 01:58:47 AddToWallet 1c91517aeadd12bcbcfdf4a1423b671d405543ae9abfbd87078969ce1971663f
2015-11-04 01:58:47 AddToWallet b11f9c2e3b1ab3d3983da63783bb95903d89405243d0716ea88272a9261b7a33
</code></pre>

CC BY-SA 3.0
2015-11-04T03:29:12.487Z
That's really strange. Can you pastebin the full log, including where the blocks are added/removed?
Nick ODell
CC BY-SA 3.0
2015-11-04T03:37:21.970Z
Agreed, can you show us where the blockchain height decreased to 38? It's not in the log you've posted.
Jimmy Song
CC BY-SA 3.0
2015-11-04T04:55:26.870Z
@NickODell http://codeshare.io/lp1G6
bawejakunal
CC BY-SA 3.0
2015-11-04T06:22:48.997Z
Best chain is selected by the most cumulative difficulty, not height. Your modifications have essentially ensured frequent forks and reorganisations. The difficulty adjustments are long in Bitcoin are a long period partly as attack resistance, but also to avoid noisy chain movements. It's completely legal for the height of the chain to drastically reduce.
Claris
CC BY-SA 3.0
2015-11-04T07:32:55.483Z
@Bitcoin But the log bawejakunal posted shows that the total work goes down when the client changes the blockchain. Before: `height=181  log2_work=37.083613` After: `height=38  log2_work=36.832912` The 38 block chain is entirely contained within the 181 block chain.
Nick ODell
CC BY-SA 3.0
2015-11-04T08:29:55.860Z
@NickODell I think there's other misguided tinkering going on in that case which we aren't seeing. It's difficult to say without knowing the whole patch set.
Claris
CC BY-SA 3.0
2015-11-04T15:55:37.963Z
@bawejakunal, I don't see anything in the link you provided. Can you try pastebin?
Jimmy Song
CC BY-SA 3.0
2015-11-04T21:20:08.147Z
@JimmySong Reuploaded: https://gist.github.com/nickodell/1d8f29faad7a566c08fd
Nick ODell
<blockchain><bitcoind><altcoin-development><chain-reorganization>
In what scenarios can the blockchain size decrease for bitcoin?
bawejakunal
# In what scenarios can the blockchain size decrease for bitcoin?

(Asked by: username_0 on 2015-11-04)

I am running a private bitcoin network for which I changed the target time between two blocks to `12 seconds` and the difficulty adjustment to `25 blocks` interval. I ran the network for about 4 hours with 50 nodes. In one of the node's logs I observed that the blockchain height increased up to a maximum of 181 and then started decreasing, all the way to 38. what could be an explanation for such a strange behaviour.

Please refer to the log below:

```
2015-11-04 01:58:47 receive version message: /Satoshi:0.11.99/: version 70011, blocks=181, us=0.0.0.0:0, peer=2, peeraddr=127.0.0.1:44117
2015-11-04 01:58:47 UpdateTip: new best=0000005265ca4ce01ad0d06f45cf475bf303de3d64e942c5cf1177e00f346c78  height=180  log2_work=37.083283  tx=30941  date=2015-11-04 01:53:17 progress=1.000000  cache=0.0MiB(1tx)
2015-11-04 01:58:47 UpdateTip: new best=00000052a34cedf3c5ddbeb46d36644654523db855c4cce984d2623e840dd219  height=179  log2_work=37.082953  tx=30940  date=2015-11-04 01:53:10 progress=1.000000  cache=0.0MiB(2tx)
2015-11-04 01:58:47 UpdateTip: new best=00000030fd7652affb883f05fe0c98e7fe3fbc3cfd74808e061ed05ec61c22e6  height=178  log2_work=37.082623  tx=30939  date=2015-11-04 01:52:55 progress=1.000000  cache=0.0MiB(3tx)
2015-11-04 01:58:47 AddToWallet c32bcbd8102c602a5e71ee717232e204435f331dce6fbfb9eb5d552698faa95b
2015-11-04 01:58:47 AddToWallet 1c91517aeadd12bcbcfdf4a1423b671d405543ae9abfbd87078969ce1971663f
2015-11-04 01:58:47 AddToWallet b11f9c2e3b1ab3d3983da63783bb95903d89405243d0716ea88272a9261b7a33

```

**Tags:** blockchain, bitcoind, altcoin-development, chain-reorganization

> **Comments:**
> **username_1**: That's really strange. Can you pastebin the full log, including where the blocks are added/removed?  
> **username_2**: Agreed, can you show us where the blockchain height decreased to 38? It's not in the log you've posted.  
> **username_0**: @username_1 http://codeshare.io/lp1G6  
> **username_3**: Best chain is selected by the most cumulative difficulty, not height. Your modifications have essentially ensured frequent forks and reorganisations. The difficulty adjustments are long in Bitcoin are a long period partly as attack resistance, but also to avoid noisy chain movements. It's completely legal for the height of the chain to drastically reduce.  
> **username_1**: @Bitcoin But the log username_0 posted shows that the total work goes down when the client changes the blockchain. Before: `height=181  log2_work=37.083613` After: `height=38  log2_work=36.832912` The 38 block chain is entirely contained within the 181 block chain.  
> **username_3**: @username_1 I think there's other misguided tinkering going on in that case which we aren't seeing. It's difficult to say without knowing the whole patch set.  
> **username_2**: @username_0, I don't see anything in the link you provided. Can you try pastebin?  
> **username_1**: @username_2 Reuploaded: https://gist.github.com/username_1/1d8f29faad7a566c08fd  

---

## 1 answers

### Answer by username_2 on 2015-11-05. Score: 2 | Accepted answer

It looks like this part of the code is what was adding all those UpdateTip messages:

<https://github.com/bitcoin/bitcoin/blob/8fe30fb4d130532d4a0e4c9d143f03e1b85a749e/src/main.cpp#L2234>

Essentially, bitcoind thinks another chain with more cumulative work exists on your 4-node network, though from the logs, it's hard to tell how much lower it goes. You'll have to run it for longer in order to find out.

> **Comments:**
> **username_0**: Oh so you mean this is the case of switching between two competing blockchains ?  
> **username_2**: Yes. This could happen if, for example, one of your nodes wasn't receiving blocks, only sending them.  

---

