Skip to content

Commit 4766cf7

Browse files
committed
fix update channel lookup
1 parent 01cfb35 commit 4766cf7

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

miner-apps/translator/src/lib/sv2/channel_manager/channel_manager.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -644,23 +644,17 @@ impl ChannelManager {
644644
// Update the local upstream channel's nominal hashrate so
645645
// that monitoring reports a value consistent with the
646646
// downstream vardiff estimate.
647-
self.channel_manager_data.super_safe_lock(|c| {
648-
if let Some(ref upstream_channel) = c.upstream_extended_channel {
649-
if let Ok(mut ch) = upstream_channel.write() {
650-
ch.set_nominal_hashrate(m.nominal_hash_rate);
651-
m.channel_id = ch.get_channel_id();
652-
}
647+
self.upstream_extended_channel.super_safe_lock(|channel| {
648+
if let Some(ref mut upstream_channel) = channel {
649+
upstream_channel.set_nominal_hashrate(m.nominal_hash_rate);
650+
m.channel_id = upstream_channel.get_channel_id();
653651
}
654652
});
655653
} else {
656654
// Non-aggregated: update the specific channel's nominal hashrate
657-
self.channel_manager_data.super_safe_lock(|c| {
658-
if let Some(channel) = c.extended_channels.get(&m.channel_id) {
659-
if let Ok(mut ch) = channel.write() {
660-
ch.set_nominal_hashrate(m.nominal_hash_rate);
661-
}
662-
}
663-
});
655+
if let Some(ref mut channel) = self.extended_channels.get_mut(&m.channel_id) {
656+
channel.set_nominal_hashrate(m.nominal_hash_rate);
657+
}
664658
}
665659

666660
info!(

0 commit comments

Comments
 (0)