mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-12 07:42:48 +00:00
Compare commits
2 Commits
wb/fix-pqu
...
wb/debug-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f2fb500ae | ||
|
|
b86acbbeab |
@@ -33,11 +33,8 @@ func GetFreePort() (int, error) {
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
l, err := net.ListenTCP("tcp", addr)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
defer l.Close()
|
||||
return l.Addr().(*net.TCPAddr).Port, nil
|
||||
}
|
||||
|
||||
@@ -111,6 +111,7 @@ func (c *Client) compareNewHeaderWithWitness(ctx context.Context, errc chan erro
|
||||
witness provider.Provider, witnessIndex int) {
|
||||
|
||||
lightBlock, err := witness.LightBlock(ctx, h.Height)
|
||||
// fmt.Println(lightBlock.SignedHeader)
|
||||
switch err {
|
||||
// no error means we move on to checking the hash of the two headers
|
||||
case nil:
|
||||
|
||||
@@ -2,6 +2,7 @@ package light_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
@@ -35,10 +36,11 @@ func TestClientIntegration_Update(t *testing.T) {
|
||||
app := kvstore.NewApplication()
|
||||
_, closer, err := rpctest.StartTendermint(ctx, conf, app, rpctest.SuppressStdout)
|
||||
require.NoError(t, err)
|
||||
defer func() { require.NoError(t, closer(ctx)) }()
|
||||
defer func() {
|
||||
fmt.Println("close")
|
||||
|
||||
// give Tendermint time to generate some blocks
|
||||
time.Sleep(5 * time.Second)
|
||||
require.NoError(t, closer(ctx))
|
||||
}()
|
||||
|
||||
dbDir, err := ioutil.TempDir("", "light-client-test-update-example")
|
||||
require.NoError(t, err)
|
||||
@@ -76,7 +78,14 @@ func TestClientIntegration_Update(t *testing.T) {
|
||||
// ensure Tendermint is at height 3 or higher
|
||||
_, err = waitForBlock(ctx, primary, 3)
|
||||
require.NoError(t, err)
|
||||
|
||||
for i := 0; i < 100; i++ {
|
||||
b, pErr := primary.LightBlock(ctx, 0)
|
||||
if pErr != nil {
|
||||
fmt.Println("err")
|
||||
fmt.Println(pErr)
|
||||
fmt.Println(b)
|
||||
}
|
||||
}
|
||||
h, err := c.Update(ctx, time.Now())
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, h)
|
||||
|
||||
@@ -114,6 +114,7 @@ func (p *http) LightBlock(ctx context.Context, height int64) (*types.LightBlock,
|
||||
|
||||
sh, err := p.signedHeader(ctx, h)
|
||||
if err != nil {
|
||||
fmt.Println("nil signed header")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -138,6 +139,9 @@ func (p *http) LightBlock(ctx context.Context, height int64) (*types.LightBlock,
|
||||
SignedHeader: sh,
|
||||
ValidatorSet: vs,
|
||||
}
|
||||
if lb.SignedHeader.Commit == nil {
|
||||
fmt.Println(lb)
|
||||
}
|
||||
|
||||
err = lb.ValidateBasic(p.chainID)
|
||||
if err != nil {
|
||||
|
||||
@@ -136,6 +136,8 @@ func (env *Environment) Commit(ctx *rpctypes.Context, heightPtr *int64) (*ctypes
|
||||
// use a non-canonical commit
|
||||
if height == env.BlockStore.Height() {
|
||||
commit := env.BlockStore.LoadSeenCommit(height)
|
||||
fmt.Println("not commited height")
|
||||
fmt.Println(commit)
|
||||
return ctypes.NewResultCommit(&header, commit, false), nil
|
||||
}
|
||||
|
||||
|
||||
@@ -268,6 +268,7 @@ func (bs *BlockStore) LoadSeenCommit(height int64) *types.Commit {
|
||||
panic(err)
|
||||
}
|
||||
if len(bz) == 0 {
|
||||
fmt.Println("nil bytes")
|
||||
return nil
|
||||
}
|
||||
err = proto.Unmarshal(bz, pbc)
|
||||
|
||||
Reference in New Issue
Block a user