light: return light client status on rpc /status (#7536)

*light: rpc /status returns status of light client ; code refactoring
 light: moved lightClientInfo into light.go, renamed String to ID
test/e2e: Return light client trusted height instead of SyncInfo trusted height
test/e2e/start.go: Not waiting for light client to catch up in tests. Removed querying of syncInfo in start if the node is a light node

* light: Removed call to primary /status. Added trustedPeriod to light info
* light/provider: added ID function to return IP of primary and witnesses
* light/provider/http/http_test: renamed String() to ID()
This commit is contained in:
Jasmina Malicevic
2022-01-20 14:53:20 +01:00
committed by GitHub
parent 4e5c2b5e8f
commit d68d25dcd5
15 changed files with 213 additions and 11 deletions

View File

@@ -4,10 +4,26 @@ import (
"bytes"
"errors"
"fmt"
"time"
tbytes "github.com/tendermint/tendermint/libs/bytes"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)
// Info about the status of the light client
type LightClientInfo struct {
PrimaryID string `json:"primaryID"`
WitnessesID []string `json:"witnessesID"`
NumPeers int `json:"number_of_peers,string"`
LastTrustedHeight int64 `json:"last_trusted_height,string"`
LastTrustedHash tbytes.HexBytes `json:"last_trusted_hash"`
LatestBlockTime time.Time `json:"latest_block_time"`
TrustingPeriod string `json:"trusting_period"`
// Boolean that reflects whether LatestBlockTime + trusting period is before
// time.Now() (time when /status is called)
TrustedBlockExpired bool `json:"trusted_block_expired"`
}
// LightBlock is a SignedHeader and a ValidatorSet.
// It is the basis of the light client
type LightBlock struct {