Skip to content

Commit 69f095e

Browse files
authored
Merge pull request dmnd-pool#80 from Fi3/FixStaleJobs
Flush job cache on new blocks
2 parents 0bb029a + 48ad086 commit 69f095e

3 files changed

Lines changed: 28 additions & 32 deletions

File tree

Cargo.lock

Lines changed: 20 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "demand-cli"
3-
version = "0.1.8"
3+
version = "0.1.10"
44
edition = "2021"
55

66
[dependencies]
@@ -40,7 +40,7 @@ reqwest ={ version = "0.12.20"}
4040
#demand-sv2-connection = { path = "../demand-sv2-connection"}
4141
#roles_logic_sv2 = { path = "../stratum/protocols/v2/roles-logic-sv2"}
4242
#framing_sv2 = { path = "../stratum/protocols/v2/framing-sv2"}
43-
#binary_sv2 = { path = "../stratum/protocols/v2/binary-sv2/binary-sv2"}
43+
#binary_sv2 = { path = "../stratum/protocols/v2/binary-sv2"}
4444
#noise_sv2 = {path ="../stratum/protocols/v2/noise-sv2"}
4545
#codec_sv2 = {features = ["noise_sv2","with_buffer_pool"], path = "../stratum/protocols/v2/codec-sv2" }
4646
#sv1_api = {path = "../stratum/protocols/v1" }

src/translator/proxy/bridge.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ impl Bridge {
251251
share: SubmitShareWithChannelId,
252252
) -> ProxyResult<'static, ()> {
253253
let channel_id = share.channel_id;
254+
let job_id = share.share.job_id.clone();
254255
info!("Bridge recv share for channel {:?}", channel_id);
255256
let (tx_sv2_submit_shares_ext, target_mutex) = self_
256257
.safe_lock(|s| (s.tx_sv2_submit_shares_ext.clone(), s.target.clone()))
@@ -265,7 +266,7 @@ impl Bridge {
265266
.safe_lock(|s| {
266267
let job_id = share.share.job_id.parse::<u32>().expect("Invalid job_id");
267268
if !s.valid_job_ids.contains(&job_id) {
268-
info!("Share rejected: job_id {} not in last two jobs", job_id);
269+
warn!("Share rejected: job_id {} not in last two jobs", job_id);
269270
return Err(roles_logic_sv2::Error::ShareDoNotMatchAnyJob); // rejected
270271
}
271272
s.channel_factory.set_target(&mut upstream_target);
@@ -324,6 +325,9 @@ impl Bridge {
324325
);
325326
}
326327
}
328+
Err(roles_logic_sv2::Error::ShareDoNotMatchAnyJob) => {
329+
warn!("Channel factory can not get this share's job_id: {}", job_id);
330+
}
327331
Err(e) => {
328332
return Err(Error::RolesSv2Logic(e));
329333
}
@@ -387,6 +391,7 @@ impl Bridge {
387391

388392
self_
389393
.safe_lock(|s| {
394+
s.valid_job_ids.clear();
390395
s.channel_factory
391396
.on_new_prev_hash(sv2_set_new_prev_hash.clone())
392397
})

0 commit comments

Comments
 (0)