Source of fork when restarting a node sharing same pubkey with other nodes
Created by: M5oul
When I restart one of my member node, it's not directly recognized alive by the network and his other member ally node. It's a problem, as if this node is not recognized by the network, it won't receive last blocks and will compute for nothing an existing block and will consequently fork. The network lost a computing node.
My node oftenly fork, I revert blocks as I am sure this fork is useless.
Here is some logs explained in a practice case:
- Restart, resync, this one is last block added:
2016-11-04T07:57:55+01:00 - info: Block #52209 added to the blockchain in 255 ms
2016-11-04T07:57:55+01:00 - warn: Blockchain changed!
2016-11-04T07:57:55+01:00 - info: POST Block block#52209
- Computing next block
#52210
:
(……………)
2016-11-04T07:57:57+01:00 - info: Generating proof-of-work with 4 leading zeros followed by [0-2]... (CPU usage set to 40%) for block#52210 J78bPU
2016-11-04T07:58:13+01:00 - info: Matched 3 zeros 0002FFDFE6378985A8744563E1C62E74F07027214B98E0BDBD99F4D1364D042B with Nonce = 10200000002177 for block#52210 by J78bPU
- Discover other node ten minutes after been started, with strange logs reported on this ticket:
(……………)
2016-11-04T08:06:58+01:00 - error: Routing error: %s httpCode=409, ucode=2022, message=A newer peer document is available, version=2, currency=test_net, status=UP, statusTS=1478229864, hash=6F4775E35998D233891EF528343D558D04E7E9F5C17DC57C396D25E9713C6714, first_down=null, last_try=null, pubkey=J78bPUvLjxmjaEkdjxWLeENQtcfXm7iobqB49uT1Bgp3, block=52182-00000DD68F0546C16D9B79CB44CDA0A1C3E3557EA46FA4DA6DA7A0C13018144C, signature=RRA16iXGENn7uV+pukRy7L9KmSlJzMdQXlJPnUHyavPUBt9CpGhxBwFspfZIbI1EDOuxBFDErGlpSSPyvO6YBQ==, endpoints=[BASIC_MERKLED_API desktop.moul.re 78.227.107.45 2a01:e34:ee36:b2d0:e79:cd45:ed65:147 24723, BASIC_MERKLED_API misc.moul.re 78.227.107.45 8999], raw=Version: 2
Type: Peer
Currency: test_net
PublicKey: J78bPUvLjxmjaEkdjxWLeENQtcfXm7iobqB49uT1Bgp3
Block: 52182-00000DD68F0546C16D9B79CB44CDA0A1C3E3557EA46FA4DA6DA7A0C13018144C
Endpoints:
BASIC_MERKLED_API desktop.moul.re 78.227.107.45 2a01:e34:ee36:b2d0:e79:cd45:ed65:147 24723
BASIC_MERKLED_API misc.moul.re 78.227.107.45 8999
- Continue to compute same block
#52210
, found two blocks:
(……………)
2016-11-04T08:07:35+01:00 - info: Matched 3 zeros 0001699D04888AE6C8B6734E83AC7CBC4FDD1005AF1D67C23BC5D03B04B6A017 with Nonce = 10200000067313 for block#52210 by J78bPU
2016-11-04T08:07:37+01:00 - info: Matched 4 zeros 000053673D64AD387FC3B86FD472122B4BCA19D92F7D1DB66E6457E223DA622E with Nonce = 10400000069876 for block#52210 by J78bPU
2016-11-04T08:07:43+01:00 - info: Pulling blocks from the network...
2016-11-04T08:07:44+01:00 - info: Block #52210 added to the blockchain in 361 ms
2016-11-04T08:07:44+01:00 - info: Stop proof-of-work worker #1
2016-11-04T08:07:44+01:00 - info: Stop proof-of-work worker #2
2016-11-04T08:07:44+01:00 - info: Stop proof-of-work worker #3
2016-11-04T08:07:44+01:00 - info: Stop proof-of-work worker #4
2016-11-04T08:07:44+01:00 - info: POST Block block#52210
2016-11-04T08:07:44+01:00 - info: Block #52211 added to the blockchain in 285 ms
2016-11-04T08:07:44+01:00 - warn: Waiting for the end of pulling...
2016-11-04T08:07:44+01:00 - info: POST Block block#52211
2016-11-04T08:07:45+01:00 - info: GIVEN proof-of-work for block#52210 with 4 leading zeros followed by [0-2]! stop PoW for J78bPU
2016-11-04T08:07:45+01:00 - warn: Proof-of-work computation canceled because block received
2016-11-04T08:07:45+01:00 - warn: The proof-of-work generation was canceled: Proof-of-work computation canceled because block received
2016-11-04T08:07:45+01:00 - info: Block #52212 added to the blockchain in 316 ms
2016-11-04T08:07:45+01:00 - info: Stop proof-of-work worker #1
2016-11-04T08:07:45+01:00 - info: Stop proof-of-work worker #2
2016-11-04T08:07:45+01:00 - info: Stop proof-of-work worker #3
2016-11-04T08:07:45+01:00 - info: Stop proof-of-work worker #4
2016-11-04T08:07:45+01:00 - info: POST Block block#52212
2016-11-04T08:07:45+01:00 - info: POST Peer 2GF9YTSMdF#52182
2016-11-04T08:07:47+01:00 - warn: Error: getaddrinfo ENOTFOUND fe80 fe80:33428
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
2016-11-04T08:07:47+01:00 - info: Peer 3Tyv128DBfvkMVHd8K1wQgkK2S16utrAvoqbBye7TWcg unreachable: now considered as DOWN.
2016-11-04T08:07:48+01:00 - info: Will pull blocks from the network in 10 min 0 sec
2016-11-04T08:07:48+01:00 - warn: Pulling done. Continue proof-of-work loop.
2016-11-04T08:07:48+01:00 - warn: Too old membership
- Compute next block
#52213
:
(…………………)
2016-11-04T08:07:48+01:00 - warn: Too old membership
2016-11-04T08:07:48+01:00 - info: Generating proof-of-work with 4 leading zeros followed by [0-2]... (CPU usage set to 40%) for block#52213 J78bPU
2016-11-04T08:07:49+01:00 - info: Matched 3 zeros 00079908D63CB7CCCC317166F9CF02BE384803552927A19AEDDAE7C132B8E72A with Nonce = 10100000000321 for block#52213 by J78bPU
Ouf! in this case, the node didn't generate block #52210
and didn't forked.
If this block was generated, I had to revert it, cutting the branch