其他参与者原话jgarzik原帖 ↗我怀疑 ByteReverse(或缺少它)有什么古怪。'data' 和 'nonce' 到底要不要字节反转、怎么反转,相当不清楚。
I suspect something weird going on with ByteReverse (or lack thereof). It's quite unclear whether or not 'data' and 'nonce' must be byte-reversed, and in what way.
getwork 负责字节反转。midstate、data 和 hash1 已经是大端序,你把 data 按大端序传回去即可,因此你全程用大端序工作,不需要做任何字节反转。它们与传给 ScanHash_ 函数的是同一份数据。你能把 midstate、data 和 hash1 放进 16 字节对齐的缓冲区,传给 ScanHash_ 函数,比如 ScanHash(pmidstate, pdata + 64, phash1, nHashesDone)。找到 nonce 后,把它补进 data 再调用 getwork。
getwork does the byte-reversing. midstate, data and hash1 are already big-endian, and you pass data back still big-endian, so you work in big-endian and don't have to do any byte-reversing. They're the same data that is passed to the ScanHash_ functions. You can take midstate, data and hash1, put them in 16-byte aligned buffers and pass them to a ScanHash_ function, like ScanHash(pmidstate, pdata + 64, phash1, nHashesDone). If a nonce is found, patch it into data and call getwork.
我或许应该把 ScanHash_ 函数改成用 pdata 而不是 pdata + 64,这样更一致。
I should probably change the ScanHash_ functions to use pdata instead of pdata + 64 so they're consistent.
target 是小端序,按预期应该与 m0mchil 的做法一致。(如果不是,那就应该修正。)这是唯一需要你做字节反转的地方。我猜是这样:if ByteReverse((unsigned int*)hash[6]) < (unsigned int*)target[6]。
target is little endian, it's supposed to be the same as how m0mchil's did it. (if it's not, then it should be fixed) That's the only case where you would use byte reverse. I think you do it like: if ByteReverse((unsigned int*)hash[6]) < (unsigned int*)target[6].
其他参与者原话DiabloD3原帖 ↗中本聪,请修正你的 getwork 实现,使其符合 m0mchill 的规范
Satoshi, please fix your implementation of getwork so it complies with m0mchill's specification
这就是新规范。更新你的挖矿程序来使用这套接口,应该不难。
This is the new spec. It shouldn't be hard to update your miner to use it.
变化有:
The changes are:
当前版本尚未建立逐条校对状态记录。来源核验、历史审校与当前译文校对是不同事项。
译文内容版本:63d0aa37088f。用于比对文本,不代表校对等级或更新时间。
请填写对应原文、现译文、建议译法和理由。复制后通过你联系本站作者的渠道提交;此处不会自动发送。