Skip to content

Running devnet always results in "isSynced: false" #508

@IgorKhomenko

Description

@IgorKhomenko

Describe the bug

I'm running a devnet locally via

cargo run --release --bin kaspad -- --devnet --rpclisten=127.0.0.1:16110 --listen=127.0.0.1:16111

Then I'm checking the status on network via https://github.com/imalfect/KaspaNodeMonitor which always says the node is not synced:

[23:16:00 07/23/2024] [ℹ INFO] Kaspa: Node is not synced, waiting for it to sync
[23:16:01 07/23/2024] [✔ LOG] info {
  p2pId: '8bf8254f-37df-46b7-9f00-0a5662ef16ad',
  mempoolSize: '0',
  serverVersion: '0.14.1',
  isUtxoIndexed: false,
  isSynced: false
}

To Reproduce
Steps to reproduce the behavior:

  1. clone rusty-kaspa
  2. run it via cargo run --release --bin kaspad -- --devnet --rpclisten=127.0.0.1:16110 --listen=127.0.0.1:16111
  3. run getInfoRequest rpc to get the node status

Expected behavior
The getInfoRequest rpc to return isSynced: false

Screenshots

Desktop (please complete the following information):

  • OS: macOS 14.5 Sonama
  • Kaspad version: rusty-kaspa main branch

Additional context
I found the rott cause is laying in is_nearly_synced https://github.com/kaspanet/rusty-kaspa/blob/master/consensus/core/src/config/params.rs#L240

I modified the code to get more logs:

let max_expected_duration_without_blocks_in_milliseconds = self.target_time_per_block * NEW_DIFFICULTY_WINDOW_DURATION / 3; // = DAA duration in milliseconds / bps / 3
let res = unix_now() < sink_timestamp + max_expected_duration_without_blocks_in_milliseconds;

println!("max_expected_duration_without_blocks_in_milliseconds {}", max_expected_duration_without_blocks_in_milliseconds);
println!("sink_timestamp {}", sink_timestamp);
println!("unix_now()  {}", unix_now() );

println!("res {}", res);
            
res

where it's clearly noticed that sink_timestamp has much lover value than unix_now() so the statement let res = unix_now() < sink_timestamp + max_expected_duration_without_blocks_in_milliseconds; can't be true

max_expected_duration_without_blocks_in_milliseconds 880333
sink_timestamp 1231006505000
unix_now()  1721765761634
res false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions