Commit 92ff2bd3 authored by mdj33's avatar mdj33 Committed by vipwzw

fix ut

parent 42c9be94
......@@ -109,6 +109,7 @@ func (suite *CommitTestSuite) SetupSuite() {
Block: &types.Block{},
}
MainBlockHash10 = blockDetail.Block.Hash()
blockDetail.Block.MainHash = MainBlockHash10
// setup title nodes : len = 4
nodeConfigKey := calcManageConfigNodesKey(Title)
......@@ -133,8 +134,12 @@ func (suite *CommitTestSuite) SetupSuite() {
suite.api.On("GetBlockByHashes", hashes).Return(
&types.BlockDetails{
Items: []*types.BlockDetail{blockDetail},
}, nil).Once()
suite.api.On("GetBlocks", &types.ReqBlocks{Start: TitleHeight, End: TitleHeight}).Return(
&types.BlockDetails{
Items: []*types.BlockDetail{blockDetail},
}, nil)
suite.api.On("GetBlockHash", &types.ReqInt{Height: MainBlockHeight}).Return(
suite.api.On("GetBlockHash", &types.ReqInt{Height: TitleHeight}).Return(
&types.ReplyHash{Hash: CurBlock}, nil)
}
......@@ -805,9 +810,6 @@ func TestUpdateCommitBlockHashs(t *testing.T) {
}
updateCommitBlockHashs(stat, commit2)
assert.Equal(t, int(2), len(stat.BlockDetails.BlockHashs))
assert.Equal(t, int(2), len(stat.BlockDetails.CrossTxHashs))
assert.Equal(t, commit2.BlockHash, stat.BlockDetails.BlockHashs[1])
assert.Equal(t, commit.CrossTxHashs[0], stat.BlockDetails.CrossTxHashs[0])
assert.Equal(t, commit2.CrossTxHashs[0], stat.BlockDetails.CrossTxHashs[1])
}
......@@ -309,6 +309,7 @@ func (p ParacrossType) CreateRawTransferTx(action string, param json.RawMessage)
return tx, nil
}
//GetDappForkHeight get paracross dapp fork height
func GetDappForkHeight(forkKey string) int64 {
var forkHeight int64
if types.IsPara() {
......@@ -340,6 +341,7 @@ func GetDappForkHeight(forkKey string) int64 {
return forkHeight
}
// IsParaForkHeight check height more than fork height
func IsParaForkHeight(height int64, forkKey string) bool {
return height >= GetDappForkHeight(forkKey)
}
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