JayDDee / cpuminer-opt

Optimized multi algo CPU miner
Other
763 stars 541 forks source link

fix hash/target log format issue; #376

Closed randydu closed 1 year ago

randydu commented 1 year ago

the format string has only 6 bytes but the hash value has 8 bytes.

JayDDee commented 1 year ago

32 bytes actually but only 24 displayed, but fewer still are valid.

Although the format is incorrect there is more to this issue. The hash and target displayed for rejected shares is not exact, it's converted from the difficulty. The data not displayed is just garbage anyway, it exceeds the precision of the diff. This change doesn't fix anything, it just displays more garbage. There is no point in changing it without addressing the underlying problem. Making the exact hash available when a specific share is replied requires saving it in the submit queue, adding more overhead that would only be used when a share is rejected. This is not a good trade.

Unless you have a better suggestion for displaying exact hash this issue won't be pursued and the PR should be closed.

randydu commented 1 year ago

Sorry for my misleading comment, the issue reported here is a mismatch of format string and provided arguments, there are 6 "%08x" in format string but 8 items to display.

JayDDee commented 1 year ago

I understand the technicality of the formatting error but the real problem is the data is invalid. Your suggested fix will only display more invalid data.

Edit: This is enough I'm closing this. We're talking at different levels. I'm talking abouy a 3rd year design issue and you're still at programming for dummies. You didn't understand what I wrote so you assumed I was stupid. It was rude to send a PR or issue to someone you don't know and doesn't know you without properly introducing yourself, especially for such a trivial issue. The stupid mistakes, lack of research and dismissing my response because you didn't understand it just made the situation worse.

JayDDee commented 1 year ago

For the record the hash and target will be removed from the share rejected log because they are not exact and therefore useless except for comparing difficulty of shares rejected for low difficulty. For low difficulty rejects the share and target difficulties will be displayed instead. This will effectively remove the offending formatting errors.