Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hairtail committed May 22, 2024
1 parent 7d156a9 commit 21b0f45
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/postrs/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,15 @@ func GeneratePow(dataDir string, postServer string, priority uint, challenge []b
config.pow_difficulty[i] = C.uchar(b)
}

cPow := C.generate_pow(dataDirPtr, challengePtr, config, C.size_t(nonces), powFlags, postServerPtr, C.size_t(priority))
cPow := C.generate_pow(dataDirPtr, (*C.uchar)(challengePtr), config, C.size_t(nonces), powFlags, postServerPtr, C.size_t(priority))

if cPow == nil {
goStr := C.GoString(cPow)
C.free(unsafe.Pointer(cPow))
if &goStr == nil {
return nil, fmt.Errorf("got nil")
}

return &cPow, nil
return &goStr, nil
}

func GenerateProof(dataDir string, postServer string, powResponse string, challenge []byte, logger *zap.Logger, nonces, threads uint, K1, K2 uint32, powDifficulty [32]byte, powFlags PowFlags, options ...PostOptionFunc) (*shared.Proof, error) {
Expand Down

0 comments on commit 21b0f45

Please sign in to comment.