fix(proxy): honour invalid custom diff suffixes

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-04 20:48:10 +00:00
parent 86c07943b0
commit d42c21438a
2 changed files with 3 additions and 2 deletions

View file

@ -18,8 +18,8 @@ func TestCustomDiff_OnLogin(t *testing.T) {
if miner.User() != "WALLET+abc" {
t.Fatalf("expected invalid suffix to remain unchanged")
}
if miner.customDiff != 10000 {
t.Fatalf("expected global diff fallback for invalid suffix, got %d", miner.customDiff)
if miner.customDiff != 0 {
t.Fatalf("expected invalid suffix to disable custom diff, got %d", miner.customDiff)
}
miner = &Miner{user: "WALLET"}

View file

@ -896,6 +896,7 @@ func parseLoginUser(login string, globalDiff uint64) (string, uint64) {
if parsed, err := strconv.ParseUint(login[plus+1:], 10, 64); err == nil {
return login[:plus], parsed
}
return login, 0
}
if globalDiff > 0 {
return login, globalDiff