Commit 76bc9a00 authored by 张振华's avatar 张振华

update

parent 4ac096ed
...@@ -228,18 +228,33 @@ func DposPerf() { ...@@ -228,18 +228,33 @@ func DposPerf() {
block := dposClient.GetCurrentBlock() block := dposClient.GetCurrentBlock()
notify := &ttypes.Notify{ notify := &ttypes.Notify{
DPosNotify: &ttypes.DPosNotify{ DPosNotify: &ttypes.DPosNotify{
Vote: dposClient.csState.currentVote, Vote: &ttypes.VoteItem{
VotedNodeIndex: vote.VoteItem.VotedNodeIndex,
Cycle: vote.VoteItem.Cycle,
CycleStart: vote.VoteItem.CycleStart,
CycleStop: vote.VoteItem.CycleStop,
PeriodStart: vote.VoteItem.PeriodStart,
PeriodStop: vote.VoteItem.PeriodStop,
Height: vote.VoteItem.Height,
ShuffleType: vote.VoteItem.ShuffleType,
},
HeightStop: block.Height, HeightStop: block.Height,
HashStop: block.Hash(), HashStop: block.Hash(),
NotifyTimestamp: now, NotifyTimestamp: now,
NotifyNodeAddress: dposClient.csState.privValidator.GetAddress(), NotifyNodeAddress: vote.VoteItem.VotedNodeAddress,
NotifyNodeIndex: int32(dposClient.csState.privValidatorIndex), NotifyNodeIndex: int32(vote.VoteItem.VotedNodeIndex),
}, },
} }
notify.DPosNotify.Vote.VotedNodeAddress = make([]byte, len(vote.VoteItem.VotedNodeAddress))
copy(notify.DPosNotify.Vote.VotedNodeAddress, vote.VoteItem.VotedNodeAddress)
notify.DPosNotify.Vote.VoteID = make([]byte, len(vote.VoteItem.VoteID))
copy(notify.DPosNotify.Vote.VoteID, vote.VoteItem.VoteID)
if err := dposClient.csState.privValidator.SignNotify(dposClient.csState.validatorMgr.ChainID, notify); err != nil { if err := dposClient.csState.privValidator.SignNotify(dposClient.csState.validatorMgr.ChainID, notify); err != nil {
fmt.Println("SignNotify failed.") fmt.Println("SignNotify failed.")
} else { } else {
fmt.Println("Notify:\n", notify.String())
if dposClient.csState.VerifyNotify(notify.DPosNotify) { if dposClient.csState.VerifyNotify(notify.DPosNotify) {
fmt.Println("Verify Notify ok.") fmt.Println("Verify Notify ok.")
} else { } else {
......
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