fix: dont send an empty buffer to bao
This commit is contained in:
parent
d5e2770135
commit
b272e32185
|
@ -67,12 +67,13 @@ func (v *Verifier) Read(p []byte) (int, error) {
|
||||||
|
|
||||||
timeStart := time.Now()
|
timeStart := time.Now()
|
||||||
|
|
||||||
|
if bytesRead > 0 {
|
||||||
if status, err := bao.Verify(buf[:bytesRead], v.read, v.proof.Proof, v.proof.Hash); err != nil || !status {
|
if status, err := bao.Verify(buf[:bytesRead], v.read, v.proof.Proof, v.proof.Hash); err != nil || !status {
|
||||||
return n, errors.Join(ErrVerifyFailed, err)
|
return n, errors.Join(ErrVerifyFailed, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
v.read += uint64(bytesRead)
|
v.read += uint64(bytesRead)
|
||||||
v.buffer.Write(buf[:bytesRead]) // Append new data to the buffer
|
v.buffer.Write(buf[:bytesRead]) // Append new data to the buffer
|
||||||
|
}
|
||||||
|
|
||||||
timeEnd := time.Now()
|
timeEnd := time.Now()
|
||||||
v.verifyTime += timeEnd.Sub(timeStart)
|
v.verifyTime += timeEnd.Sub(timeStart)
|
||||||
|
|
Loading…
Reference in New Issue