dtr-org / unit-e

A digital currency for a new era of decentralized trust
https://unit-e.io
MIT License
45 stars 15 forks source link

Commits full sync degrades to the headers full sync #967

Open frolosofsky opened 5 years ago

frolosofsky commented 5 years ago

Describe the bug After processing some amount of headers+commits messages (several thousands or alike in my current scenario), commits exchange fade out, and node fallbacks to the headers full sync. After new peer connected, node initializes new commits+headers exchange round but it seems that both syncs work in parallel (commits have priority within the peer btw).

To Reproduce

  1. Launch unit-e in testnet.
  2. See logs. Grep hints: headers+commits, commits full sync asked.

Expected behavior During full sync, only headers+commits must transfer headers.

The normal behavior:

2019-04-12 08:51:52 [finalization] Process commits block_hash=78eb9a84c5bf412405373d8684dc10249e0a83818a29eeeb60aafece1a46bb19 height=2

...

2019-04-12 08:51:52 [         net] received block 78eb9a84c5bf412405373d8684dc10249e0a83818a29eeeb60aafece1a46bb19 peer=0
2019-04-12 08:51:52 [finalization] Process candidate tip block_hash=78eb9a84c5bf412405373d8684dc10249e0a83818a29eeeb60aafece1a46bb19 height=2
2019-04-12 08:51:52 [finalization] State for block_hash=78eb9a84c5bf412405373d8684dc10249e0a83818a29eeeb60aafece1a46bb19 heigh=2 has been processed from commits, confirming...
2019-04-12 08:51:52 [finalization] State for block_hash=78eb9a84c5bf412405373d8684dc10249e0a83818a29eeeb60aafece1a46bb19 height=2 confirmed
2019-04-12 08:51:52 [finalization] Process tip block_hash=78eb9a84c5bf412405373d8684dc10249e0a83818a29eeeb60aafece1a46bb19 height=2
2019-04-12 08:51:52 [finalization] State for block_hash=78eb9a84c5bf412405373d8684dc10249e0a83818a29eeeb60aafece1a46bb19 height=2 has been already processed
2019-04-12 08:51:52 [            ] UpdateTip: new best=78eb9a84c5bf412405373d8684dc10249e0a83818a29eeeb60aafece1a46bb19 height=2 version=0x00000001 log2_work=54.701305 tx=3 date='2019-04-11 15:36:48' progress=1.000000 cache=0.1MiB(641txo)

Note messages "process commits" and "State ... has been processed from commits, confirming..."

Abnormal:

2019-04-12 09:23:43 [finalization] Process candidate tip block_hash=248ce01c8a54a3a5ab8a73ee9ef838c9fde487adc62e3fcb0200202936340218 height=7000
2019-04-12 09:23:43 [finalization] ProcessNewCommits: Last block of the epoch, new m_recommended_target_hash=248ce01c8a54a3a5ab8a73ee9ef838c9fde4
87adc62e3fcb0200202936340218
2019-04-12 09:23:43 [            ] Read 218d34be057dae2c3466b1ed70db3907aca605012a5fb9a95c19a0c3e733dab3 from the disk

...

2019-04-12 09:24:16 [finalization] Process tip block_hash=248ce01c8a54a3a5ab8a73ee9ef838c9fde487adc62e3fcb0200202936340218 height=7000
2019-04-12 09:24:16 [finalization] State for block_hash=248ce01c8a54a3a5ab8a73ee9ef838c9fde487adc62e3fcb0200202936340218 height=7000 has been already processed
2019-04-12 09:24:16 [            ] UpdateTip: new best=248ce01c8a54a3a5ab8a73ee9ef838c9fde487adc62e3fcb0200202936340218 height=7000 version=0x00000001 log2_work=66.700407 tx=601288 date='2019-04-12 06:54:12' progress=1.000000 cache=5.7MiB(39912txo)

Environment Master dee0b86aca67a959b0d75bba251ceae2d88bcc94