fix HeightAndHashPresent func

This commit is contained in:
Anton Kaliaev
2019-07-09 17:55:55 +04:00
parent 1f03ceb0ba
commit f95b11e07a
2 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ type TrustOptions struct {
// HeightAndHashPresent returns true if TrustHeight and TrustHash are present.
func (opts TrustOptions) HeightAndHashPresent() bool {
return opts.TrustHeight > 0 && opts.TrustHash != 0
return opts.TrustHeight > 0 && len(opts.TrustHash) > 0
}
// Provider implements a persistent caching Provider that auto-validates. It
+6 -5
View File
@@ -11,6 +11,7 @@ import (
dbm "github.com/tendermint/tendermint/libs/db"
log "github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/lite"
pks "github.com/tendermint/tendermint/lite/internal/privkeys"
"github.com/tendermint/tendermint/types"
)
@@ -21,7 +22,7 @@ func TestProviderValidPath(t *testing.T) {
// Set up the validators to generate test blocks.
var vote int64 = 10
keys := lite.GenPrivKeys(5)
keys := pks.GenPrivKeys(5)
nkeys := keys.Extend(1)
// Construct a bunch of commits, each with one more height than the last.
@@ -93,9 +94,9 @@ func TestProviderDynamicVerification(t *testing.T) {
// gen the 2 val sets
chainID := "dynamic-verifier"
power := int64(10)
keys1 := lite.GenPrivKeys(5)
keys1 := pks.GenPrivKeys(5)
vals1 := keys1.ToValidators(power, 0)
keys2 := lite.GenPrivKeys(5)
keys2 := pks.GenPrivKeys(5)
vals2 := keys2.ToValidators(power, 0)
// make some commits with the first
@@ -148,7 +149,7 @@ func TestVerifingProviderHistorical(t *testing.T) {
// Set up the validators to generate test blocks.
var vote int64 = 10
keys := lite.GenPrivKeys(5)
keys := pks.GenPrivKeys(5)
nkeys := keys.Extend(1)
// Construct a bunch of commits, each with one more height than the last.
@@ -230,7 +231,7 @@ func TestConcurrentProvider(t *testing.T) {
// Set up the validators to generate test blocks.
var vote int64 = 10
keys := lite.GenPrivKeys(5)
keys := pks.GenPrivKeys(5)
nkeys := keys.Extend(1)
// Construct a bunch of commits, each with one more height than the last.