Fix bogus height check

This commit is contained in:
Alexis Sellier 2017-08-08 16:19:40 +02:00
parent 7857f25649
commit 80ef09f1ee
1 changed files with 3 additions and 4 deletions

View File

@ -80,7 +80,6 @@ func getWithProof(key []byte, node client.Client, cert Certifier) (data.Bytes, u
if err != nil {
return nil, 0, nil, nil, err
}
ph := int(resp.Height)
// make sure the proof is the proper height
if !resp.Code.IsOK() {
@ -89,11 +88,11 @@ func getWithProof(key []byte, node client.Client, cert Certifier) (data.Bytes, u
if len(resp.Key) == 0 || len(resp.Proof) == 0 {
return nil, 0, nil, nil, lc.ErrNoData()
}
if ph != 0 && ph != int(resp.Height) {
return nil, 0, nil, nil, lc.ErrHeightMismatch(ph, int(resp.Height))
if resp.Height == 0 {
return nil, 0, nil, nil, errors.New("Height returned is zero")
}
check, err := GetCertifiedCheckpoint(ph, node, cert)
check, err := GetCertifiedCheckpoint(int(resp.Height), node, cert)
if err != nil {
return nil, 0, nil, nil, err
}