mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-04 20:21:15 +00:00
31 lines
892 B
Go
31 lines
892 B
Go
package tests
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/XinFinOrg/XDPoSChain/consensus/XDPoS"
|
|
"github.com/XinFinOrg/XDPoSChain/consensus/XDPoS/utils"
|
|
"github.com/XinFinOrg/XDPoSChain/params"
|
|
)
|
|
|
|
func TestSyncInfoForFirstV2BlockMsgWithoutQC(t *testing.T) {
|
|
// Block 11 is the first v2 block with starting round of 0
|
|
blockchain, _, currentBlock, _, _ := PrepareXDCTestBlockChainForV2Engine(t, 11, params.TestXDPoSMockChainConfigWithV2Engine, 0)
|
|
engineV2 := blockchain.Engine().(*XDPoS.XDPoS).EngineV2
|
|
|
|
var extraField utils.ExtraFields_v2
|
|
err := utils.DecodeBytesExtraFields(currentBlock.Extra(), &extraField)
|
|
if err != nil {
|
|
t.Fatal("Fail to decode extra data", err)
|
|
}
|
|
|
|
syncInfoMsg := &utils.SyncInfo{
|
|
HighestQuorumCert: extraField.QuorumCert,
|
|
HighestTimeoutCert: nil, // Initial value?
|
|
}
|
|
|
|
err = engineV2.SyncInfoHandler(blockchain, syncInfoMsg)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|