Commit b9131d64 authored by Litian's avatar Litian Committed by 33cn

非ticket共识下,不启用ticket钱包插件

parent c9d15bc5
......@@ -15,7 +15,9 @@ import (
rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util/testnode"
wcom "github.com/33cn/chain33/wallet/common"
ty "github.com/33cn/plugin/plugin/dapp/ticket/types"
"github.com/33cn/plugin/plugin/dapp/ticket/wallet"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
context "golang.org/x/net/context"
......@@ -127,6 +129,9 @@ func TestJrpc_GetTicketCount(t *testing.T) {
func TestRPC_CallTestNode(t *testing.T) {
api := new(mocks.QueueProtocolAPI)
cfg, sub := testnode.GetDefaultConfig()
// 测试环境下,默认情况是不注册ticket钱包插件的,而且默认配置的共识为solo,需要修改
cfg.Consensus.Name = "ticket"
wcom.RegisterPolicy(ty.TicketX, wallet.New())
mock33 := testnode.NewWithConfig(cfg, sub, api)
defer func() {
mock33.Close()
......
......@@ -20,6 +20,7 @@ import (
"github.com/33cn/chain33/types"
wcom "github.com/33cn/chain33/wallet/common"
ty "github.com/33cn/plugin/plugin/dapp/ticket/types"
"strings"
)
var (
......@@ -28,7 +29,14 @@ var (
)
func init() {
wcom.RegisterPolicy(ty.TicketX, New())
// 只有ticket共识下ticket相关的操作才有效
q := types.Conf("config.consensus")
if q != nil {
cons := q.GStr("name")
if strings.Compare(strings.TrimSpace(cons), ty.TicketX) == 0 {
wcom.RegisterPolicy(ty.TicketX, New())
}
}
}
// New new instance
......
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