Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -531,11 +531,19 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager {
};

downstream.downstream_data.super_safe_lock(|data| {
let mut messages: Vec<RouteMessageTo> = vec![];
let extended_channel_id =
data.channel_id_factory.fetch_add(1, Ordering::Relaxed);
if data.require_std_job {
return Ok(vec![(
downstream_id,
build_error("only-accept-standard-job"),
)
.into()])
}

let extranonce_prefix = match channel_manager_data
let mut messages: Vec<RouteMessageTo> = vec![];
let extended_channel_id =
data.channel_id_factory.fetch_add(1, Ordering::Relaxed);

let extranonce_prefix = match channel_manager_data
.extranonce_allocator
.allocate_extended(requested_min_rollable_extranonce_size.into())
{
Expand Down Expand Up @@ -789,7 +797,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager {
_ => "internal-error",
};
if err_code == "internal-error" {
warn!("Failed to update extended channel {channel_id}");
warn!("Failed to update standard channel {channel_id}");
} else {
return vec![(downstream_id, build_error(err_code)).into()];
}
Expand All @@ -808,14 +816,18 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager {
} else if let Some(extended_channel) =
data.extended_channels.get_mut(&channel_id)
{
if data.require_std_job {
return vec![(downstream_id, build_error("invalid-channel-id")).into()];
}

let update_channel = extended_channel.update_channel(
new_nominal_hash_rate,
Some(requested_maximum_target),
);
let new_target = extended_channel.get_target();

if let Err(e) = update_channel {
error!(channel_id, ?e, "StandardChannel update failed");
error!(channel_id, ?e, "ExtendedChannel update failed");
let err_code = match e {
ExtendedChannelError::InvalidNominalHashrate => {
"invalid-nominal-hashrate"
Expand Down Expand Up @@ -1197,6 +1209,10 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager {
return Err(JDCError::disconnect(JDCErrorKind::LastNewPrevhashNotFound, downstream_id));
};
downstream.downstream_data.super_safe_lock(|data| {
if data.require_std_job {
return Ok(vec![(downstream_id, build_error("invalid-channel-id")).into()]);
}

let mut messages: Vec<RouteMessageTo> = vec![];

let Some(extended_channel) = data.extended_channels.get_mut(&channel_id) else {
Expand Down