Commit ef9e3ebe authored by madengji's avatar madengji Committed by 33cn

fix ut cov

parent ef673e64
......@@ -8,6 +8,8 @@ import (
"fmt"
"testing"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/crypto"
"github.com/stretchr/testify/assert"
)
......@@ -46,6 +48,19 @@ func TestSignAndVerify(t *testing.T) {
assert.Equal(t, false, ret)
}
func TestPrivKeyFromBytes(t *testing.T) {
keybyte, _ := common.FromHex("0xcacb1f5d51700aea07fca2246ab43b0917d70405c65edea9b5063d72eb5c6b71")
p, err := blsDrv.PrivKeyFromBytes(keybyte)
assert.Nil(t, p)
assert.NotNil(t, err)
keybyte, _ = common.FromHex("0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b")
p, err = blsDrv.PrivKeyFromBytes(keybyte)
assert.NotNil(t, p)
assert.Nil(t, err)
}
func TestAggregate(t *testing.T) {
m := []byte("message to be signed. 将要做签名的消息")
n := 8
......
......@@ -51,7 +51,8 @@ func (mem *Mempool) SetQueueClient(client queue.Client) {
reply, err = mem.mainGrpcCli.GetProperFee(context.Background(), &types.ReqProperFee{})
case types.EventGetMempoolSize:
// 消息类型EventGetMempoolSize:获取mempool大小
msg.Reply(mem.client.NewMessage("rpc", types.EventMempoolSize, &types.MempoolSize{Size: 1000000}))
size := types.Conf(client.GetConfig(), "config.mempool").GInt("poolCacheSize")
msg.Reply(mem.client.NewMessage("rpc", types.EventMempoolSize, &types.MempoolSize{Size: size}))
continue
default:
msg.Reply(client.NewMessage(mem.key, types.EventReply, types.ErrActionNotSupport))
......
......@@ -47,4 +47,13 @@ func TestParaNodeMempool(t *testing.T) {
_, err := mockpara.Para.GetAPI().GetMempool(&types.ReqGetMempool{})
assert.Equal(t, err, types.ErrActionNotSupport)
t.Log(err)
msg := para.GetClient().NewMessage("mempool", types.EventGetMempoolSize, nil)
para.GetClient().Send(msg, true)
reply, err := para.GetClient().Wait(msg)
if err != nil {
t.Error(err)
return
}
t.Log("TestGetMempoolSize ", reply.GetData().(*types.MempoolSize).Size)
}
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