Skip to content

Commit

Permalink
Should not set ResponseSent flag if we are the primary
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang committed Feb 16, 2019
1 parent 6d88860 commit 3c801dc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions neo/Consensus/ConsensusService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,12 @@ private bool AddTransaction(Transaction tx, bool verify)
{
if (context.VerifyRequest())
{
context.State |= ConsensusState.ResponseSent;

// if we are the primary for this view, but acting as a backup because we recovered our own
// previously sent prepare request, then we don't want to send a prepare response.
if (context.MyIndex == context.PrimaryIndex) return true;

Log($"send prepare response");
context.State |= ConsensusState.ResponseSent;
var payload = context.MakePrepareResponse(context.PreparationPayloads[context.PrimaryIndex].Hash);
context.PreparationPayloads[context.MyIndex] = payload;
localNode.Tell(new LocalNode.SendDirectly { Inventory = payload });
Expand Down

0 comments on commit 3c801dc

Please sign in to comment.