Skip to content

Commit

Permalink
Merge pull request #678 from GitGab19/fix-outdated-timestamp
Browse files Browse the repository at this point in the history
Fix outdated timestamp
  • Loading branch information
Fi3 authored Nov 24, 2023
2 parents 5c799c4 + f8263ae commit 88d4ad9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion roles/jd-client/src/upstream_sv2/upstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,19 @@ impl Upstream {
};
tokio::task::yield_now().await;
};

let updated_timestamp = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_secs() as u32;

let to_send = SetCustomMiningJob {
channel_id,
request_id,
token: signed_token,
version: declare_mining_job.version,
prev_hash: set_new_prev_hash.prev_hash,
min_ntime: set_new_prev_hash.header_timestamp,
min_ntime: updated_timestamp,
nbits: set_new_prev_hash.n_bits,
coinbase_tx_version,
coinbase_prefix,
Expand Down
2 changes: 1 addition & 1 deletion roles/translator/src/downstream_sv1/diff_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ mod test {
Arc::new(Mutex::new(upstream_config)),
);

let total_run_time = std::time::Duration::from_secs(60);
let total_run_time = std::time::Duration::from_secs(120);
let config_shares_per_minute = downstream_conf.shares_per_minute;
// get initial hashrate
let initial_nominal_hashrate = measure_hashrate(10);
Expand Down
5 changes: 4 additions & 1 deletion roles/translator/src/proxy/next_mining_notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ pub fn create_notify(
// u32 -> HexBytes
let version = HexU32Be(new_job.version);
let bits = HexU32Be(new_prev_hash.nbits);
let time = HexU32Be(new_prev_hash.min_ntime);
let time = HexU32Be(match new_job.is_future() {
true => new_prev_hash.min_ntime,
false => new_job.min_ntime.clone().into_inner().unwrap(),
});

let notify_response = server_to_client::Notify {
job_id,
Expand Down

0 comments on commit 88d4ad9

Please sign in to comment.