Fix return value when nothing is found
This commit is contained in:
parent
d1b49da825
commit
668eea8628
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user