Commit 23b237bf authored by 张振华's avatar 张振华

Merge branch 'master' into guess

parents 13813d32 f4d8ec54
......@@ -60,7 +60,7 @@ type client struct {
conn *grpc.ClientConn
grpcClient types.Chain33Client
paraClient paracross.ParacrossClient
isCatchingUp bool
isCaughtUp bool
commitMsgClient *commitMsgClient
authAccount string
privateKey crypto.PrivKey
......@@ -119,6 +119,7 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
paraClient: paraCli,
authAccount: cfg.AuthAccount,
privateKey: priKey,
isCaughtUp: false,
}
if cfg.WaitBlocks4CommitMsg < 2 {
......@@ -444,9 +445,9 @@ func (client *client) RequestTx(currSeq int64, preMainBlockHash []byte) ([]*type
plog.Info("GetCurrentSeq", "Len of txs", len(txs), "seqTy", seqTy)
if lastSeq-currSeq > emptyBlockInterval {
client.isCatchingUp = true
client.isCaughtUp = false
} else {
client.isCatchingUp = false
client.isCaughtUp = true
}
if client.authAccount != "" {
......@@ -654,7 +655,7 @@ func (client *client) CreateBlock() {
plog.Error("Incorrect sequence type")
incSeqFlag = false
}
if !client.isCatchingUp {
if client.isCaughtUp {
time.Sleep(time.Second * time.Duration(blockSec))
}
}
......@@ -766,6 +767,14 @@ func (client *client) DelBlock(block *types.Block, seq int64) error {
return nil
}
//IsCaughtUp 是否追上最新高度,
func (client *client) Query_IsCaughtUp(req *types.ReqNil) (types.Message, error) {
if client == nil {
return nil, fmt.Errorf("%s", "client not bind message queue.")
}
return &types.IsCaughtUp{Iscaughtup: client.isCaughtUp}, nil
}
func checkMinerTx(current *types.BlockDetail) error {
//检查第一个笔交易的execs, 以及执行状态
if len(current.Block.Txs) == 0 {
......
......@@ -83,7 +83,7 @@ out:
}
case block := <-client.mainBlockAdd:
if client.currentTx != nil && !client.paraClient.isCatchingUp {
if client.currentTx != nil && client.paraClient.isCaughtUp {
exist := checkTxInMainBlock(client.currentTx, block)
if exist {
finishHeight = sendingHeight
......
......@@ -11,6 +11,7 @@ import (
"os"
"strings"
"github.com/33cn/chain33/rpc/jsonclient"
"github.com/33cn/chain33/types"
pt "github.com/33cn/plugin/plugin/dapp/paracross/types"
"github.com/spf13/cobra"
......@@ -29,6 +30,7 @@ func ParcCmd() *cobra.Command {
CreateRawTransferCmd(),
CreateRawWithdrawCmd(),
CreateRawTransferToExecCmd(),
IsSyncCmd(),
)
return cmd
}
......@@ -281,3 +283,20 @@ func createTransferTx(cmd *cobra.Command, isWithdraw bool) (string, error) {
txHex := types.Encode(tx)
return hex.EncodeToString(txHex), nil
}
// IsSyncCmd query parachain is sync
func IsSyncCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "is_sync",
Short: "query parachain is sync",
Run: isSync,
}
return cmd
}
func isSync(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
var res bool
ctx := jsonclient.NewRPCCtx(rpcLaddr, "paracross.IsSync", nil, &res)
ctx.Run()
}
......@@ -2,6 +2,7 @@ syntax = "proto3";
import "transaction.proto";
import "common.proto";
import "blockchain.proto";
package types;
......@@ -130,4 +131,5 @@ service paracross {
rpc ListTitles(ReqNil) returns (RespParacrossTitles) {}
rpc GetTitleHeight(ReqParacrossTitleHeight) returns (ReceiptParacrossDone) {}
rpc GetAssetTxResult(ReqHash) returns (ParacrossAsset) {}
rpc IsSync(ReqNil) returns (IsCaughtUp) {}
}
\ No newline at end of file
......@@ -91,3 +91,26 @@ func (c *Jrpc) GetAssetTxResult(req *types.ReqHash, result *interface{}) error {
*result = data
return err
}
// IsSync query is sync
func (c *channelClient) IsSync(ctx context.Context, in *types.ReqNil) (*types.IsCaughtUp, error) {
data, err := c.QueryConsensusFunc("para", "IsCaughtUp", &types.ReqNil{})
if err != nil {
return nil, err
}
return data.(*types.IsCaughtUp), nil
}
// IsSync query is sync
func (c *Jrpc) IsSync(in *types.ReqNil, result *interface{}) error {
//TODO consensus and paracross are not the same registered names ?
data, err := c.cli.QueryConsensusFunc("para", "IsCaughtUp", &types.ReqNil{})
*result = false
if err != nil {
return err
}
if reply, ok := data.(*types.IsCaughtUp); ok {
*result = reply.Iscaughtup
}
return nil
}
/*
* Copyright Fuzamei Corp. 2018 All Rights Reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
*/
package rpc
//only load all plugin and system
import (
"testing"
"github.com/33cn/chain33/client/mocks"
rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
pt "github.com/33cn/plugin/plugin/dapp/paracross/types"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
)
func newGrpc(api *mocks.QueueProtocolAPI) *channelClient {
return &channelClient{
ChannelClient: rpctypes.ChannelClient{QueueProtocolAPI: api},
}
}
func newJrpc(api *mocks.QueueProtocolAPI) *Jrpc {
return &Jrpc{cli: newGrpc(api)}
}
func TestChannelClient_GetTitle(t *testing.T) {
api := new(mocks.QueueProtocolAPI)
client := newGrpc(api)
client.Init("paracross", nil, nil, nil)
req := &types.ReqString{Data: "xxxxxxxxxxx"}
api.On("Query", pt.GetExecName(), "GetTitle", req).Return(&pt.ParacrossStatus{}, nil)
_, err := client.GetTitle(context.Background(), req)
assert.Nil(t, err)
}
func TestJrpc_GetTitle(t *testing.T) {
api := new(mocks.QueueProtocolAPI)
j := newJrpc(api)
req := &types.ReqString{Data: "xxxxxxxxxxx"}
var result interface{}
api.On("Query", pt.GetExecName(), "GetTitle", req).Return(&pt.ParacrossStatus{}, nil)
err := j.GetHeight(req, &result)
assert.Nil(t, err)
}
func TestChannelClient_ListTitles(t *testing.T) {
api := new(mocks.QueueProtocolAPI)
client := newGrpc(api)
client.Init("paracross", nil, nil, nil)
req := &types.ReqNil{}
api.On("Query", pt.GetExecName(), "ListTitles", req).Return(&pt.RespParacrossTitles{}, nil)
_, err := client.ListTitles(context.Background(), req)
assert.Nil(t, err)
}
func TestJrpc_ListTitles(t *testing.T) {
api := new(mocks.QueueProtocolAPI)
j := newJrpc(api)
req := &types.ReqNil{}
var result interface{}
api.On("Query", pt.GetExecName(), "ListTitles", req).Return(&pt.RespParacrossTitles{}, nil)
err := j.ListTitles(req, &result)
assert.Nil(t, err)
}
func TestChannelClient_GetTitleHeight(t *testing.T) {
api := new(mocks.QueueProtocolAPI)
client := newGrpc(api)
client.Init("paracross", nil, nil, nil)
req := &pt.ReqParacrossTitleHeight{}
api.On("Query", pt.GetExecName(), "GetTitleHeight", req).Return(&pt.ReceiptParacrossDone{}, nil)
_, err := client.GetTitleHeight(context.Background(), req)
assert.Nil(t, err)
}
func TestJrpc_GetTitleHeight(t *testing.T) {
api := new(mocks.QueueProtocolAPI)
j := newJrpc(api)
req := &pt.ReqParacrossTitleHeight{}
var result interface{}
api.On("Query", pt.GetExecName(), "GetTitleHeight", req).Return(&pt.ReceiptParacrossDone{}, nil)
err := j.GetTitleHeight(req, &result)
assert.Nil(t, err)
}
func TestChannelClient_GetAssetTxResult(t *testing.T) {
api := new(mocks.QueueProtocolAPI)
client := newGrpc(api)
client.Init("paracross", nil, nil, nil)
req := &types.ReqHash{}
api.On("Query", pt.GetExecName(), "GetAssetTxResult", req).Return(&pt.ParacrossAsset{}, nil)
_, err := client.GetAssetTxResult(context.Background(), req)
assert.Nil(t, err)
}
func TestJrpc_GetAssetTxResult(t *testing.T) {
api := new(mocks.QueueProtocolAPI)
j := newJrpc(api)
req := &types.ReqHash{}
var result interface{}
api.On("Query", pt.GetExecName(), "GetAssetTxResult", req).Return(&pt.ParacrossAsset{}, nil)
err := j.GetAssetTxResult(req, &result)
assert.Nil(t, err)
}
func TestChannelClient_IsSync(t *testing.T) {
api := new(mocks.QueueProtocolAPI)
client := newGrpc(api)
client.Init("paracross", nil, nil, nil)
req := &types.ReqNil{}
api.On("QueryConsensusFunc", "para", "IsCaughtUp", req).Return(&types.IsCaughtUp{}, nil)
_, err := client.IsSync(context.Background(), req)
assert.Nil(t, err)
}
func TestJrpc_IsSync(t *testing.T) {
api := new(mocks.QueueProtocolAPI)
J := newJrpc(api)
req := &types.ReqNil{}
var result interface{}
api.On("QueryConsensusFunc", "para", "IsCaughtUp", req).Return(&types.IsCaughtUp{}, nil)
err := J.IsSync(req, &result)
assert.Nil(t, err)
}
//TODO wait finish
//func TestRPC_CallTestNode(t *testing.T) {
// api := new(mocks.QueueProtocolAPI)
// cfg, sub := testnode.GetDefaultConfig()
// // para consensus
// cfg.Consensus.Name = "para"
// cfg.Title="user.p.test."
// cfg.BlockChain.IsParaChain=true
// cfg.Store.Name="mavl"
// mock33 := testnode.NewWithConfig(cfg, sub, api)
// defer func() {
// mock33.Close()
// mock.AssertExpectationsForObjects(t, api)
// }()
// g := newGrpc(api)
// g.Init(pt.GetExecName(), mock33.GetRPC(), newJrpc(api), g)
// time.Sleep(time.Millisecond)
// mock33.Listen()
// time.Sleep(time.Millisecond)
// api.On("Query", pt.GetExecName(), "GetTitle", &types.ReqString{}).Return(&pt.ParacrossStatus{Title:"test"}, nil)
// api.On("Query", pt.GetExecName(), "ListTitles", &types.ReqNil{}).Return(&pt.RespParacrossTitles{Titles:[]*pt.ReceiptParacrossDone{&pt.ReceiptParacrossDone{Title:"test1"},&pt.ReceiptParacrossDone{Title:"test2"}}}, nil)
// api.On("Query", pt.GetExecName(), "GetTitleHeight", &pt.ReqParacrossTitleHeight{}).Return(&pt.ReceiptParacrossDone{Height:10}, nil)
// api.On("Query", pt.GetExecName(), "GetAssetTxResult", &types.ReqHash{}).Return(&pt.ParacrossAsset{Symbol:"test"}, nil)
// api.On("QueryConsensusFunc", "para", "IsCaughtUp",&types.ReqNil{}).Return(&types.IsCaughtUp{Iscaughtup:true}, nil)
// //test jrpc
// rpcCfg := mock33.GetCfg().RPC
// jsonClient, err := jsonclient.NewJSONClient("http://" + rpcCfg.JrpcBindAddr + "/")
// assert.Nil(t, err)
// assert.NotNil(t, jsonClient)
// var result pt.ParacrossStatus
// err = jsonClient.Call("paracross.GetHeight", nil, &result)
// fmt.Println(err)
// assert.Nil(t, err)
// assert.Equal(t, "test", result.Title)
//
// var reply types.IsCaughtUp
// err = jsonClient.Call("paracross.IsSync", &types.ReqNil{}, &reply)
// assert.Nil(t, err)
// assert.Equal(t, true, reply.Iscaughtup)
//
// var res pt.RespParacrossTitles
// err = jsonClient.Call("paracross.ListTitles", &types.ReqNil{}, &res)
// assert.Nil(t, err)
// assert.Equal(t, 2, len(res.Titles))
//
// //test grpc
//
// ctx := context.Background()
// c, err := grpc.DialContext(ctx, rpcCfg.GrpcBindAddr, grpc.WithInsecure())
// assert.Nil(t, err)
// assert.NotNil(t, c)
//
// client := pt.NewParacrossClient(c)
// issync, err := client.IsSync(ctx, &types.ReqNil{})
// assert.Nil(t, err)
// assert.Equal(t, true, issync.Iscaughtup)
//}
......@@ -1241,69 +1241,71 @@ func init() {
func init() { proto.RegisterFile("paracross.proto", fileDescriptor_6a397e38c9ea6747) }
var fileDescriptor_6a397e38c9ea6747 = []byte{
// 985 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4b, 0x6f, 0x23, 0x45,
0x10, 0xf6, 0x8c, 0xdf, 0xe5, 0xd8, 0x09, 0xbd, 0x89, 0x77, 0x34, 0x2c, 0xc8, 0x1a, 0x01, 0xb2,
0x38, 0x44, 0xc8, 0x91, 0x82, 0x10, 0xe2, 0xb0, 0x2f, 0xc5, 0x5a, 0x96, 0x05, 0x75, 0x22, 0x71,
0x42, 0x62, 0x32, 0xee, 0xdd, 0x8c, 0xf0, 0xb8, 0xbd, 0xd3, 0xed, 0xdd, 0xe4, 0xce, 0x91, 0x33,
0x3f, 0x83, 0x0b, 0xff, 0x81, 0x03, 0xbf, 0x0a, 0x75, 0xf5, 0x63, 0x1e, 0xb6, 0xac, 0x08, 0xb8,
0x75, 0x55, 0x7f, 0x55, 0xd5, 0x55, 0xf5, 0x75, 0x75, 0xc3, 0xe1, 0x3a, 0xce, 0xe3, 0x24, 0xe7,
0x42, 0x9c, 0xae, 0x73, 0x2e, 0x39, 0x69, 0xcb, 0xbb, 0x35, 0x13, 0xe1, 0x07, 0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 0x03, 0x59,
0x25, 0x68, 0x1e, 0xf9, 0x13, 0x44, 0x6c, 0xe9, 0xd5, 0xf9, 0xd5, 0x77, 0xce, 0xa0, 0xc6, 0x88,
0x2a, 0x69, 0xd4, 0xdb, 0x28, 0x36, 0x49, 0xc2, 0x84, 0x08, 0x1e, 0x62, 0x72, 0x56, 0x9c, 0xfd,
0xe6, 0x43, 0xdf, 0xfd, 0x04, 0xc9, 0x39, 0xf4, 0x2e, 0x98, 0xc4, 0x06, 0x90, 0x23, 0x57, 0xef,
0xb7, 0x97, 0x32, 0x4f, 0x57, 0x6f, 0xc2, 0xf1, 0xee, 0xaf, 0x53, 0xd4, 0x20, 0x5f, 0x01, 0xbc,
0x4c, 0x85, 0x34, 0x9d, 0x1b, 0x16, 0x96, 0xaf, 0xd2, 0x65, 0x18, 0x3a, 0x71, 0xab, 0xc9, 0x51,
0x83, 0x7c, 0x0f, 0x23, 0x1b, 0xd2, 0x26, 0x53, 0x98, 0xef, 0x62, 0x57, 0xb8, 0x8f, 0x08, 0x51,
0x83, 0x7c, 0x0d, 0x47, 0x17, 0x4c, 0x62, 0xef, 0xdd, 0xdb, 0x3e, 0x2a, 0x5c, 0xaa, 0xbe, 0x85,
0x27, 0xf5, 0x4c, 0x10, 0x1e, 0x35, 0xae, 0x3b, 0xf8, 0xc7, 0x3d, 0xfb, 0x27, 0x00, 0x00, 0xff,
0xff, 0x6c, 0x00, 0x31, 0x06, 0x1e, 0x0b, 0x00, 0x00,
// 1020 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x5f, 0x6f, 0x1b, 0x45,
0x10, 0xf7, 0x9d, 0xff, 0x66, 0x1c, 0x3b, 0xe9, 0x36, 0x71, 0x4f, 0x47, 0x41, 0xd6, 0x09, 0x90,
0x85, 0x50, 0x84, 0x1c, 0x29, 0x08, 0x21, 0x1e, 0xda, 0xb4, 0x8a, 0x5b, 0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6f, 0xfe, 0x71, 0x3d, 0x13, 0x34, 0x0f,
0x1a, 0xe4, 0x73, 0xe8, 0x3c, 0x13, 0x97, 0x9b, 0x34, 0xaa, 0x27, 0x71, 0x4f, 0x8b, 0xcf, 0xc4,
0x79, 0xb8, 0xbe, 0x59, 0xc8, 0x1f, 0x57, 0x41, 0xe3, 0xba, 0x83, 0x3f, 0xe2, 0xd3, 0x7f, 0x03,
0x00, 0x00, 0xff, 0xff, 0x8a, 0x1e, 0xc2, 0xb5, 0x5e, 0x0b, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
......@@ -1322,6 +1324,7 @@ type ParacrossClient interface {
ListTitles(ctx context.Context, in *types.ReqNil, opts ...grpc.CallOption) (*RespParacrossTitles, error)
GetTitleHeight(ctx context.Context, in *ReqParacrossTitleHeight, opts ...grpc.CallOption) (*ReceiptParacrossDone, error)
GetAssetTxResult(ctx context.Context, in *types.ReqHash, opts ...grpc.CallOption) (*ParacrossAsset, error)
IsSync(ctx context.Context, in *types.ReqNil, opts ...grpc.CallOption) (*types.IsCaughtUp, error)
}
type paracrossClient struct {
......@@ -1368,12 +1371,22 @@ func (c *paracrossClient) GetAssetTxResult(ctx context.Context, in *types.ReqHas
return out, nil
}
func (c *paracrossClient) IsSync(ctx context.Context, in *types.ReqNil, opts ...grpc.CallOption) (*types.IsCaughtUp, error) {
out := new(types.IsCaughtUp)
err := c.cc.Invoke(ctx, "/types.paracross/IsSync", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ParacrossServer is the server API for Paracross service.
type ParacrossServer interface {
GetTitle(context.Context, *types.ReqString) (*ParacrossStatus, error)
ListTitles(context.Context, *types.ReqNil) (*RespParacrossTitles, error)
GetTitleHeight(context.Context, *ReqParacrossTitleHeight) (*ReceiptParacrossDone, error)
GetAssetTxResult(context.Context, *types.ReqHash) (*ParacrossAsset, error)
IsSync(context.Context, *types.ReqNil) (*types.IsCaughtUp, error)
}
func RegisterParacrossServer(s *grpc.Server, srv ParacrossServer) {
......@@ -1452,6 +1465,24 @@ func _Paracross_GetAssetTxResult_Handler(srv interface{}, ctx context.Context, d
return interceptor(ctx, in, info, handler)
}
func _Paracross_IsSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(types.ReqNil)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ParacrossServer).IsSync(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/types.paracross/IsSync",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ParacrossServer).IsSync(ctx, req.(*types.ReqNil))
}
return interceptor(ctx, in, info, handler)
}
var _Paracross_serviceDesc = grpc.ServiceDesc{
ServiceName: "types.paracross",
HandlerType: (*ParacrossServer)(nil),
......@@ -1472,6 +1503,10 @@ var _Paracross_serviceDesc = grpc.ServiceDesc{
MethodName: "GetAssetTxResult",
Handler: _Paracross_GetAssetTxResult_Handler,
},
{
MethodName: "IsSync",
Handler: _Paracross_IsSync_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "paracross.proto",
......
......@@ -91,7 +91,7 @@ func NewJoinTable(left *Table, right *Table, indexes []string) (*JoinTable, erro
join.leftIndex = append(join.leftIndex, joinindex[0])
}
if joinindex[1] == "" || !right.canGet(joinindex[1]) {
return nil, errors.New("jointable: left table can not get: " + joinindex[1])
return nil, errors.New("jointable: right table can not get: " + joinindex[1])
}
if joinindex[1] != "" {
join.rightIndex = append(join.rightIndex, joinindex[1])
......@@ -160,6 +160,7 @@ func (join *JoinTable) GetData(primaryKey []byte) (*Row, error) {
}
rowjoin := join.meta.CreateRow()
rowjoin.Ty = None
rowjoin.Primary = leftrow.Primary
rowjoin.Data.(*JoinData).Left = leftrow.Data
rowjoin.Data.(*JoinData).Right = rightrow.Data
return rowjoin, nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment