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 13, 2020
1 parent c0f0005 commit 1352f61
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions source/agora/node/Validator.d
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +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);

// 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);

super.onAcceptedBlock(block, validators_changed);

assert(block.header.height >= this.last_shuffle_height);

const need_shuffle = block.header.height >=
Expand Down

0 comments on commit 1352f61

Please sign in to comment.