Skip to content

Commit

Permalink
Fix consensus when changing view
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang committed Sep 5, 2019
1 parent f41c3d6 commit a561e3e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions neo/Consensus/ConsensusContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,7 @@ public void Reset(byte viewNumber)
{
PrevHash = Snapshot.CurrentBlockHash,
Index = Snapshot.Height + 1,
NextConsensus = Blockchain.GetConsensusAddress(NativeContract.NEO.GetValidators(Snapshot).ToArray()),
ConsensusData = new ConsensusData()
NextConsensus = Blockchain.GetConsensusAddress(NativeContract.NEO.GetValidators(Snapshot).ToArray())
};
var pv = Validators;
Validators = NativeContract.NEO.GetNextBlockValidators(Snapshot);
Expand Down Expand Up @@ -390,7 +389,10 @@ public void Reset(byte viewNumber)
LastChangeViewPayloads[i] = null;
}
ViewNumber = viewNumber;
Block.ConsensusData.PrimaryIndex = GetPrimaryIndex(viewNumber);
Block.ConsensusData = new ConsensusData
{
PrimaryIndex = GetPrimaryIndex(viewNumber)
};
Block.MerkleRoot = null;
Block.Timestamp = 0;
Block.Transactions = null;
Expand Down

0 comments on commit a561e3e

Please sign in to comment.