Interesting discovery in bitcoind (sv) today. Apparently Bitcoin SV internally is maintaining two header branches at the same time, the BSV branch and the BCH branch. Only blocks on the BSV branch are accepted, but headers on both branches are being accepted and the BCH headers are being added to the CBlockIndex header tree memory structure. This is on version 0.2.0
Discovered this when I found a massive multi-month deep active fork in a project I'm building, at first I thought I had a bug, took a bit to discover that the 2nd (longer but inactive) branch was BCH headers.
@shadders if you're here that probably should be fixed FYI.
Here is an internal trace of bitcoind block and header acceptance showing this. This node started ~1 hour behind. On startup:
- It first downloaded and accepted BCH headers 59189X
- It then downloaded and accepted BSV headers 59172X
- It then downloaded and accepted new BSV 59172X blocks, but not 59189X BCH blocks
- From there it receives new blocks as they are found
- New BSV blocks accept a header and then the new block
- New BCH blocks accept a header (but not a block)
It is correct that the BCH blocks are rejected but pollutes the blockindex structures by accepting their headers in-memory.
Anyway, I thought it was an interesting find so wanted to share.
Code:
2019-07-18 20:56:04.726443 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591894 hash 0000000000000000002bb5dd01557259db349cef42927736ca3f09d3219e8b67
2019-07-18 20:56:04.726817 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591895 hash 00000000000000000430e9787bc4614a2e6147496cbc5fbe15d1a9e1166868b5
2019-07-18 20:56:04.727136 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591896 hash 0000000000000000016939c024d327a6aa3d3bcbd7364412640d13dd65021eba
2019-07-18 20:56:04.727460 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591897 hash 000000000000000000421e5c89a07b622b5565071c0c59e2c8c91b4ea486e632
2019-07-18 20:56:16.293678 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591725 hash 00000000000000000837ccdaef500449bdad22992f87bf58e2bb25fcc83155a9
2019-07-18 20:56:16.293939 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591726 hash 00000000000000000416d28dd6550af7bd2dec2abda3a3d5fd0e212eb552641e
2019-07-18 20:56:16.294220 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591727 hash 0000000000000000027016b2b0b0dbded162ee29e8c11759f9b2b300568c0f6c
2019-07-18 20:56:16.294485 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591728 hash 0000000000000000051378698ca1b5c70a98a445ecc4d9dc884a0a5514298341
2019-07-18 20:56:16.294679 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591729 hash 000000000000000005ad429b7980d30024675bae0115198eb9a61f2ac394c425
2019-07-18 20:56:17.095926 -------> AcceptBlock <------- NewBlock (pindex height 591725 hash 00000000000000000837ccdaef500449bdad22992f87bf58e2bb25fcc83155a9
2019-07-18 20:56:19.278521 -------> AcceptBlock <------- NewBlock (pindex height 591726 hash 00000000000000000416d28dd6550af7bd2dec2abda3a3d5fd0e212eb552641e
2019-07-18 20:56:19.297958 -------> AcceptBlock <------- NewBlock (pindex height 591727 hash 0000000000000000027016b2b0b0dbded162ee29e8c11759f9b2b300568c0f6c
2019-07-18 20:56:19.365326 -------> AcceptBlock <------- NewBlock (pindex height 591728 hash 0000000000000000051378698ca1b5c70a98a445ecc4d9dc884a0a5514298341
2019-07-18 20:56:19.424367 -------> AcceptBlock <------- NewBlock (pindex height 591729 hash 000000000000000005ad429b7980d30024675bae0115198eb9a61f2ac394c425
2019-07-18 21:06:08.812093 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591898 hash 00000000000000000116d0ea4b013f87ef9128edf13f50db27a409c83e9e7898
2019-07-18 21:13:29.559167 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591730 hash 000000000000000000ad5c86cf1c981cb02aa1cc7e56de270ec84b9e187b0e96
2019-07-18 21:13:31.879454 -------> AcceptBlock <------- NewBlock (pindex height 591730 hash 000000000000000000ad5c86cf1c981cb02aa1cc7e56de270ec84b9e187b0e96
2019-07-18 21:13:33.061976 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591731 hash 000000000000000002ef7a7877f4ffc9abb62bf80e0d46c85c125d2190bdf60b
2019-07-18 21:13:33.312821 -------> AcceptBlock <------- NewBlock (pindex height 591731 hash 000000000000000002ef7a7877f4ffc9abb62bf80e0d46c85c125d2190bdf60b
2019-07-18 21:16:25.491044 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591732 hash 00000000000000000051dfb643da8cc6a5758be2691e27cfe6da61a7fbf307de
2019-07-18 21:16:26.234549 -------> AcceptBlock <------- NewBlock (pindex height 591732 hash 00000000000000000051dfb643da8cc6a5758be2691e27cfe6da61a7fbf307de
2019-07-18 21:17:44.990051 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591733 hash 000000000000000007135ec4d75e9cfa0e3a76de97ad589684512df936c90acd
2019-07-18 21:17:45.239047 -------> AcceptBlock <------- NewBlock (pindex height 591733 hash 000000000000000007135ec4d75e9cfa0e3a76de97ad589684512df936c90acd
2019-07-18 21:17:56.085952 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591899 hash 000000000000000002ae120922d8cf3cb1e8a53964ea4b0f85ac539fc48dd379
2019-07-18 21:30:44.801865 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591900 hash 00000000000000000012846679fe965046f3e89277e3781fe57d78c6482efc56
2019-07-18 21:39:54.500246 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591734 hash 000000000000000000d58b8375cef4eeb26096c06afa4cdd0fc5eb2c02a4c238
2019-07-18 21:39:55.152368 -------> AcceptBlock <------- NewBlock (pindex height 591734 hash 000000000000000000d58b8375cef4eeb26096c06afa4cdd0fc5eb2c02a4c238
2019-07-18 21:40:02.387567 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591901 hash 0000000000000000026f056542c75535c2c243bb5a4e13b734fcc310d689023f
2019-07-18 21:41:14.178544 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591735 hash 0000000000000000092e0004d239def0ff0e3e3bfdf1e95e1d75b04425660005
2019-07-18 21:41:14.179680 -------> AcceptBlock <------- NewBlock (pindex height 591735 hash 0000000000000000092e0004d239def0ff0e3e3bfdf1e95e1d75b04425660005
2019-07-18 21:42:14.705604 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591902 hash 000000000000000001bb8a7702ac820ec18b013e965671ef32f241592f6cbf40
2019-07-18 21:43:04.741152 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591903 hash 000000000000000002bdb4d2a143d8772df8412a238326ed7c0f5f893a21a865
2019-07-18 21:43:11.123789 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591904 hash 000000000000000003449115cecb3000cdd12dad3153454d1312d427227b506b
2019-07-18 21:54:05.852280 -------> AcceptBlockHeader <------- NewHeader(pindexNew height 591905 hash 000000000000000001e33e2eb32b9229624e3222a32548155a030147a4c6593b