Skip to content

bug: clamp being used incorrectly after hours running #49

@rkuester

Description

@rkuester

Discussed in #48

Originally posted by johnnyasantoss March 12, 2026
Hello,

I couldn't create an issue so I'll be using this discussion thread to report a bug.

Yesterday I was testing and reviewing #33, after sending the review I left my bitaxe 602 mining the whole night on that branch to gather more data to plot (it was pretty stable after modifications).
I woke up and found this log:

thread 'tokio-runtime-worker' (31152351) panicked at /Users/johnny/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs:1094:9:
assertion failed: min <= max
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Unfortunately I was running without backtrace (shame), but after a quick repo wide search I only found one place were clamp is used with dynamic inputs:

let measurement_target = MEASUREMENT_SHARE_RATE.to_target(hashrate);
let flood_cap_target = FLOOD_CAP_RATE.to_target(hashrate);
source_target.clamp(measurement_target, flood_cap_target)

The miner continued mining but I'm not sure that it should. I'm not that familiar with the codebase to tell just by looking at this piece of code to say which thread was running this. Maybe an essential actor?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions