Commit bc1f392a authored by mdj33's avatar mdj33 Committed by 33cn

fix paracross ut

parent 19116644
......@@ -18,6 +18,7 @@ import (
dbmock "github.com/33cn/chain33/common/db/mocks"
"github.com/33cn/chain33/types"
pt "github.com/33cn/plugin/plugin/dapp/paracross/types"
"github.com/33cn/plugin/plugin/dapp/paracross/testnode"
)
// para-exec addr on main 1HPkPopVe3ERfvaAgedDtJQ792taZFEHCe
......@@ -27,6 +28,12 @@ var (
Amount = int64(1 * types.Coin)
)
func para_init(title string){
cfg, _ := types.InitCfgString(testnode.DefaultConfig)
types.Init(title, cfg)
}
// 构建跨链交易, 用1个节点即可, 不测试共识
// assetTransfer
// 分别测试在主链和平行链的情况
......@@ -156,7 +163,7 @@ func (suite *AssetTransferTestSuite) TestExecTransfer() {
}
func (suite *AssetTransferTestSuite) TestExecTransferInPara() {
types.Init(Title, nil)
para_init(Title)
toB := Nodes[1]
tx, err := createAssetTransferTx(suite.Suite, PrivKeyA, toB)
......@@ -260,7 +267,7 @@ func (suite *AssetTransferTestSuite) TestExecTransferToken() {
}
func (suite *AssetTransferTestSuite) TestExecTransferTokenInPara() {
types.Init(Title, nil)
para_init(Title)
toB := Nodes[1]
tx, err := createAssetTransferTokenTx(suite.Suite, PrivKeyA, toB)
......
......@@ -106,7 +106,7 @@ func (suite *AssetWithdrawTestSuite) TestExecAssetWithdrawOnMainChain() {
// 平行链执行
func (suite *AssetWithdrawTestSuite) TestExecAssetWithdrawOnParaChain() {
types.Init(Title, nil)
para_init(Title)
// make coins for transfer
total := 1000 * types.Coin
......@@ -212,7 +212,7 @@ func (suite *AssetWithdrawTestSuite) TestExecAssetWithdrawAfterPara() {
}
func (suite *AssetWithdrawTestSuite) TestExecWithdrawFailedOnPara() {
types.Init(Title, nil)
para_init(Title)
// make coins for transfer
acc := account.NewCoinsAccount()
acc.SetDB(suite.stateDB)
......
......@@ -452,14 +452,14 @@ type VoteTestSuite struct {
}
func (s *VoteTestSuite) SetupSuite() {
types.Init(Title, nil)
para_init(Title)
s.exec = newParacross().(*Paracross)
}
func (s *VoteTestSuite) TestVoteTx() {
status := &pt.ParacrossNodeStatus{
MainBlockHash: MainBlockHash10,
MainBlockHeight: MainBlockHeight,
MainBlockHeight: 0,
PreBlockHash: PerBlock,
Height: CurHeight,
Title: Title,
......@@ -588,7 +588,8 @@ func (s *VoteTestSuite) TestVoteTxFork() {
// s.T().Log("tx exec name","i",i,"name",string(tx.Execer))
//}
types.S("config.consensus.sub.para.MainForkParacrossCommitTx", int64(1))
//types.S("config.consensus.sub.para.MainForkParacrossCommitTx", int64(1))
//val,_:=types.G("config.consensus.sub.para.MainForkParacrossCommitTx")
errlog := &types.ReceiptLog{Ty: types.TyLogErr, Log: []byte("")}
feelog := &types.Receipt{}
......
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