Commit 209dceff authored by vipwzw's avatar vipwzw Committed by 33cn

fix linter

parent 3b66a970
......@@ -93,7 +93,6 @@ func newParaChainAPI(api client.QueueProtocolAPI, grpcaddr string) ExecutorAPI {
if paraRemoteGrpcClient == "" {
paraRemoteGrpcClient = "127.0.0.1:8002"
}
println("------", paraRemoteGrpcClient)
conn, err := grpc.Dial(paraRemoteGrpcClient, grpc.WithInsecure())
if err != nil {
panic(err)
......
......@@ -34,6 +34,11 @@ func TestAPI(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, randhash, []byte("hello"))
assert.Equal(t, false, eapi.IsErr())
api.On("QueryTx", mock.Anything).Return(&types.TransactionDetail{Height: 1}, nil)
param3 := &types.ReqHash{Hash: []byte("hash")}
txdetail, err := eapi.QueryTx(param3)
assert.Nil(t, err)
assert.Equal(t, int64(1), txdetail.Height)
types.SetTitleOnlyForTest("user.p.wzw.")
//testnode setup
rpcCfg := new(types.RPC)
......@@ -63,6 +68,10 @@ func TestAPI(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, randhash, []byte("hello"))
assert.Equal(t, false, eapi.IsErr())
param3 = &types.ReqHash{Hash: []byte("hash")}
txdetail, err = eapi.QueryTx(param3)
assert.Nil(t, err)
assert.Equal(t, int64(1), txdetail.Height)
//queue err
assert.Equal(t, false, IsQueueError(nil))
assert.Equal(t, false, IsQueueError(errors.New("xxxx")))
......
......@@ -400,7 +400,10 @@ func (d *DriverBase) GetHeight() int64 {
// GetMainHeight return height
func (d *DriverBase) GetMainHeight() int64 {
if types.IsPara() {
return d.mainHeight
}
return d.height
}
// GetBlockTime return block time
......
......@@ -76,7 +76,8 @@ func TestDriverAPI(t *testing.T) {
demo := LoadDriverAllow(tx, 0, 1).(*demoApp)
dir, ldb, kvdb := util.CreateTestDB()
defer util.CloseTestDB(dir, ldb)
demo.SetEnv(1, time.Now().Unix(), 1, []byte("parentHash"), []byte("mainHash"))
demo.SetEnv(1, time.Now().Unix(), 1)
demo.SetBlockInfo([]byte("parentHash"), []byte("mainHash"), 1)
demo.SetLocalDB(kvdb)
demo.SetStateDB(kvdb)
demo.SetAPI(&mocks.QueueProtocolAPI{})
......@@ -88,7 +89,7 @@ func TestDriverAPI(t *testing.T) {
types.SetTitleOnlyForTest("user.p.wzw.")
assert.Equal(t, "parentHash", string(demo.GetParentHash()))
assert.Equal(t, "mainHash", string(demo.GetLastHash()))
assert.Equal(t, int64(1), demo.GetMainHeight())
assert.Equal(t, true, IsDriverAddress(ExecAddress("none"), 0))
assert.Equal(t, false, IsDriverAddress(ExecAddress("demo"), 0))
assert.Equal(t, true, IsDriverAddress(ExecAddress("demo"), 1))
......
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