mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-20 23:14:37 +00:00
Merge remote-tracking branch 'origin/master' into wb/pbts-rebase-master
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package mbt
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@@ -8,7 +9,6 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
tmjson "github.com/tendermint/tendermint/libs/json"
|
||||
"github.com/tendermint/tendermint/light"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
)
|
||||
@@ -28,7 +28,7 @@ func TestVerify(t *testing.T) {
|
||||
}
|
||||
|
||||
var tc testCase
|
||||
err = tmjson.Unmarshal(jsonBlob, &tc)
|
||||
err = json.Unmarshal(jsonBlob, &tc)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -103,7 +103,7 @@ type testCase struct {
|
||||
type initialData struct {
|
||||
SignedHeader types.SignedHeader `json:"signed_header"`
|
||||
NextValidatorSet types.ValidatorSet `json:"next_validator_set"`
|
||||
TrustingPeriod uint64 `json:"trusting_period"`
|
||||
TrustingPeriod uint64 `json:"trusting_period,string"`
|
||||
Now time.Time `json:"now"`
|
||||
}
|
||||
|
||||
|
||||
@@ -38,3 +38,7 @@ func (p proxyService) Unsubscribe(ctx context.Context, query string) (*coretypes
|
||||
func (p proxyService) UnsubscribeAll(ctx context.Context) (*coretypes.ResultUnsubscribe, error) {
|
||||
return p.UnsubscribeAllWS(ctx)
|
||||
}
|
||||
|
||||
func (p proxyService) BroadcastEvidence(ctx context.Context, ev coretypes.Evidence) (*coretypes.ResultBroadcastEvidence, error) {
|
||||
return p.Client.BroadcastEvidence(ctx, ev.Value)
|
||||
}
|
||||
|
||||
@@ -149,12 +149,24 @@ func (c *Client) ABCIQuery(ctx context.Context, path string, data tmbytes.HexByt
|
||||
}
|
||||
|
||||
// ABCIQueryWithOptions returns an error if opts.Prove is false.
|
||||
// ABCIQueryWithOptions returns the result for the given height (opts.Height).
|
||||
// If no height is provided, the results of the block preceding the latest are returned.
|
||||
func (c *Client) ABCIQueryWithOptions(ctx context.Context, path string, data tmbytes.HexBytes,
|
||||
opts rpcclient.ABCIQueryOptions) (*coretypes.ResultABCIQuery, error) {
|
||||
|
||||
// always request the proof
|
||||
opts.Prove = true
|
||||
|
||||
// Can't return the latest block results because we won't be able to
|
||||
// prove them. Return the results for the previous block instead.
|
||||
if opts.Height == 0 {
|
||||
res, err := c.next.Status(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't get latest height: %w", err)
|
||||
}
|
||||
opts.Height = res.SyncInfo.LatestBlockHeight - 1
|
||||
}
|
||||
|
||||
res, err := c.next.ABCIQueryWithOptions(ctx, path, data, opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user