Suggested Fix
diff --git a/miner-apps/translator/src/lib/sv2/channel_manager/mod.rs b/miner-apps/translator/src/lib/sv2/channel_manager/mod.rs
--- a/miner-apps/translator/src/lib/sv2/channel_manager/mod.rs
+++ b/miner-apps/translator/src/lib/sv2/channel_manager/mod.rs
@@ -879,10 +879,17 @@ impl ChannelManager {
// Find max channel ID, excluding AGGREGATED_CHANNEL_ID
// (u32::MAX) which would cause overflow when adding 1
let channel_id = self
.extended_channels
.iter()
.filter(|x| *x.key() != AGGREGATED_CHANNEL_ID)
.fold(0, |acc, x| std::cmp::max(acc, *x.key()));
let next_channel_id = channel_id + 1;
+ if next_channel_id == AGGREGATED_CHANNEL_ID {
+ error!("Refusing to allocate reserved aggregated channel ID to downstream");
+ return Err(TproxyError::fallback(
+ TproxyErrorKind::OpenMiningChannelError,
+ ));
+ }
+
let success_extranonce_prefix: Vec<u8> = new_extranonce_prefix.as_bytes().to_vec();
let new_downstream_extended_channel = ExtendedChannel::new(
next_channel_id,
Note
I'm not sure we should trigger fallback in this case, probably it's better to just disconnect the client which is asking for this new channel.
Suggested Fix
Note
I'm not sure we should trigger fallback in this case, probably it's better to just disconnect the client which is asking for this new channel.