Skip to content

Commit

Permalink
ETH: fix share submission
Browse files Browse the repository at this point in the history
  • Loading branch information
SwimmingTiger committed Jan 4, 2022
1 parent fe31513 commit c58c861
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions DownSessionETH.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ func (down *DownSessionETH) parseMiningSubmit(request *JSONRPCLineETH) (result i

if len(mixHash) > 0 {
msg.MixHash, _ = Hex2Bin(mixHash)
BinReverse(msg.MixHash) // btcpool使用小端字节序
}

go down.upSession.SendEvent(EventSubmitShareETH{request.ID, &msg})
Expand Down
1 change: 1 addition & 0 deletions StratumJobETH.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func NewStratumJobETH(json *JSONRPCLineETH, sessionID uint32) (job *StratumJobET
err = fmt.Errorf("failed to decode job id: %s", err.Error())
return
}
BinReverse(job.JobID) // btcpool使用小端字节序

seedHash, ok := json.Params[1].(string)
if !ok {
Expand Down
11 changes: 11 additions & 0 deletions Utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,14 @@ func Hex2Uint64(hexStr string) (result uint64, err error) {
result, err = strconv.ParseUint(hexStr, 16, 64)
return
}

// BinReverse 颠倒字节序列
func BinReverse(bin []byte) {
i := 0
j := len(bin) - 1
for i < j {
bin[i], bin[j] = bin[j], bin[i]
i++
j--
}
}

0 comments on commit c58c861

Please sign in to comment.