Add DEFAULT_ASSUME_VALID_TARGET_HEIGHT to calculate duration need to reach the target
Print duration to reach assume_valid_target in log msg
What problem does this PR solve?
This PR let CKB print duration needed to reach to DEFAULT_ASSUME_VALID_TARGET in log
2024-04-28 06:12:02.343 +00:00 BlockDownload INFO ckb_sync::synchronizer best known header number: 8760000, hash: Byte32(0x323b52e2309b15bb5d1bc0e3497da2905b14e2014313e1d01c8cea816b55e361), CKB is reaching the assume valid target: Byte32(0xc394fa4c5e5032c49f3502d4fd8054ead76ff693a54ac90757e441b5119afcaf) Please wait. It will take about 7.7 minutes to reach the assume valid target
2024-04-28 06:12:03.727 +00:00 BlockDownload INFO ckb_sync::synchronizer best known header number: 8770000, hash: Byte32(0xd383dacd15a1db0b746f1af2c20b845cc89222485f975a4084990c74da6904af), CKB is reaching the assume valid target: Byte32(0xc394fa4c5e5032c49f3502d4fd8054ead76ff693a54ac90757e441b5119afcaf) Please wait. It will take about 7.6 minutes to reach the assume valid target
2024-04-28 06:12:05.104 +00:00 BlockDownload INFO ckb_sync::synchronizer best known header number: 8780000, hash: Byte32(0x1e16b3079422c122acd30eaef0525a17f9828be5a3ceba79c72e9c7d69b75245), CKB is reaching the assume valid target: Byte32(0xc394fa4c5e5032c49f3502d4fd8054ead76ff693a54ac90757e441b5119afcaf) Please wait. It will take about 7.5 minutes to reach the assume valid target
print duration need to reach DEFAULT_ASSUME_VALID_TARGET in Header Sync phase
If ckb run is specified with a custom --assume-valid-target, the corresponding height of this target is not known temporarily, so it is currently not possible to calculate the time needed to reach this target.
Related changes
print duration need to reach DEFAULT_ASSUME_VALID_TARGET in Header Sync phase
Propose a new approach:
Calculate Header Sync progress and "time remaining to sync to the highest tip Header" using the timestamps of the genesis block and the latest tip header.
What problem does this PR solve?
This PR let CKB print duration needed to reach to
DEFAULT_ASSUME_VALID_TARGET
in loghttps://github.com/nervosnetwork/ckb/pull/4254#issuecomment-1840263490
print duration need to reach
DEFAULT_ASSUME_VALID_TARGET
in Header Sync phaseIf
ckb run
is specified with a custom--assume-valid-target
, the corresponding height of this target is not known temporarily, so it is currently not possible to calculate the time needed to reach this target.Related changes
DEFAULT_ASSUME_VALID_TARGET
in Header Sync phaseCheck List
Tests
Side effects
Release note