@@ -10,7 +10,6 @@ import (
1010
1111 "github.com/XinFinOrg/XDPoSChain/accounts"
1212 "github.com/XinFinOrg/XDPoSChain/accounts/abi/bind/backends"
13- "github.com/XinFinOrg/XDPoSChain/common"
1413 "github.com/XinFinOrg/XDPoSChain/consensus/XDPoS"
1514 "github.com/XinFinOrg/XDPoSChain/core/types"
1615 "github.com/XinFinOrg/XDPoSChain/params"
@@ -195,11 +194,11 @@ func TestVoteMessageHandlerSuccessfullyGeneratedAndProcessQC(t *testing.T) {
195194}
196195
197196func TestThrowErrorIfVoteMsgRoundIsMoreThanOneRoundAwayFromCurrentRound (t * testing.T ) {
198- blockchain , _ , _ , _ , _ , _ := PrepareXDCTestBlockChainForV2Engine (t , 905 , params .TestXDPoSMockChainConfig , nil )
197+ blockchain , _ , currentBlock , _ , _ , _ := PrepareXDCTestBlockChainForV2Engine (t , 905 , params .TestXDPoSMockChainConfig , nil )
199198 engineV2 := blockchain .Engine ().(* XDPoS.XDPoS ).EngineV2
200199
201200 blockInfo := & types.BlockInfo {
202- Hash : common . HexToHash ( "0x1" ),
201+ Hash : currentBlock . Hash ( ),
203202 Round : types .Round (6 ),
204203 Number : big .NewInt (999 ),
205204 }
@@ -397,15 +396,15 @@ func TestVoteMessageShallNotThrowErrorIfBlockNotYetExist(t *testing.T) {
397396 }
398397
399398 err := engineV2 .VoteHandler (blockchain , voteMsg )
400- assert .Nil (t , err )
399+ assert .Contains (t , err . Error (), "proposed block is not found" )
401400
402401 voteMsg = & types.Vote {
403402 ProposedBlockInfo : blockInfo ,
404403 Signature : SignHashByPK (acc2Key , voteSigningHash .Bytes ()),
405404 GapNumber : 450 ,
406405 }
407406 err = engineV2 .VoteHandler (blockchain , voteMsg )
408- assert .Nil (t , err )
407+ assert .Contains (t , err . Error (), "proposed block is not found" )
409408
410409 // Create a vote message that should trigger vote pool hook, but it shall not produce any QC yet
411410 voteMsg = & types.Vote {
@@ -415,7 +414,7 @@ func TestVoteMessageShallNotThrowErrorIfBlockNotYetExist(t *testing.T) {
415414 }
416415
417416 err = engineV2 .VoteHandler (blockchain , voteMsg )
418- assert .Nil (t , err )
417+ assert .Contains (t , err . Error (), "proposed block is not found" )
419418 currentRound , lockQuorumCert , highestQuorumCert , _ , _ , _ := engineV2 .GetPropertiesFaker ()
420419 // Still using the initlised value because we did not yet go to the next round
421420 assert .Nil (t , lockQuorumCert )
0 commit comments