Fix return value when nothing is found

This commit is contained in:
Alexis Sellier
2017-08-09 13:13:16 +02:00
parent d1b49da825
commit 668eea8628
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -124,7 +124,7 @@ func getWithProof(key []byte, node client.Client, cert certifiers.Certifier) (da
return nil, 0, nil, nil, err
}
return data.Bytes(resp.Value), resp.Height, nil, proof, nil
return nil, resp.Height, nil, proof, lc.ErrNoData()
}
// GetCertifiedCheckpoint gets the signed header for a given height
+2 -1
View File
@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/tendermint/go-wire"
lc "github.com/tendermint/light-client"
"github.com/tendermint/light-client/certifiers"
certclient "github.com/tendermint/light-client/certifiers/client"
nm "github.com/tendermint/tendermint/node"
@@ -75,7 +76,7 @@ func TestAppProofs(t *testing.T) {
// Test non-existing key.
missing := []byte("my-missing-key")
bs, _, proofExists, proofNotExists, err := getWithProof(missing, cl, cert)
require.Nil(err, "%+v", err)
require.True(lc.IsNoDataErr(err))
require.Nil(bs)
require.Nil(proofExists)
require.NotNil(proofNotExists)