2
1
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
That's really strange. Can you pastebin the full log, including where the blocks are added/removed? – Nick ODell – 2015-11-04T03:29:12.487
Agreed, can you show us where the blockchain height decreased to 38? It's not in the log you've posted. – Jimmy Song – 2015-11-04T03:37:21.970
@NickODell http://codeshare.io/lp1G6
– bawejakunal – 2015-11-04T04:55:26.8701Best 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. – Anonymous – 2015-11-04T06:22:48.997
@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.083613After:height=38 log2_work=36.832912The 38 block chain is entirely contained within the 181 block chain. – Nick ODell – 2015-11-04T07:32:55.483@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. – Anonymous – 2015-11-04T08:29:55.860
@bawejakunal, I don't see anything in the link you provided. Can you try pastebin? – Jimmy Song – 2015-11-04T15:55:37.963
@JimmySong Reuploaded: https://gist.github.com/nickodell/1d8f29faad7a566c08fd
– Nick ODell – 2015-11-04T21:20:08.147