Skip to content

Commit

Permalink
Stop nominating immediately after externalize
Browse files Browse the repository at this point in the history
The super call to `onAcceptedBlock()` can actually
cause a context switch, which means the call
to `stopNominationRound()` may be delayed.
  • Loading branch information
AndrejMitrovic committed Nov 16, 2020
1 parent c0f0005 commit bb17e26
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/agora/node/Validator.d
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,13 @@ public class Validator : FullNode, API
protected final override void onAcceptedBlock (const ref Block block,
bool validators_changed) @safe
{
super.onAcceptedBlock(block, validators_changed);
assert(block.header.height >= this.last_shuffle_height);

// block received either via externalize or getBlocksFrom(),
// we need to cancel any existing nominating rounds
// we need to cancel any existing nominating rounds.
// note: must be called before any context switch
this.nominator.stopNominationRound(block.header.height);

assert(block.header.height >= this.last_shuffle_height);
super.onAcceptedBlock(block, validators_changed);

const need_shuffle = block.header.height >=
(this.last_shuffle_height + this.params.QuorumShuffleInterval);
Expand Down

0 comments on commit bb17e26

Please sign in to comment.