Skip to content

Commit 960e8e5

Browse files
committed
fixed logic for Block Based Resend barrier.
1 parent 97b8fe9 commit 960e8e5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

crates/ethcore/src/engines/hbbft/keygen_transactions.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,18 @@ impl KeygenTransactionSender {
130130

131131
let current_block = client.block_number(BlockId::Latest).unwrap_or(0);
132132

133-
// this check also prevents the resending of Transaction in a manner.
133+
// this check also prevents the resending of Transactions if no block got mined. (e.g. because of stalled network)
134134
if last_sent.block_sent + KEYGEN_TRANSACTION_RESEND_DELAY_BLOCKS
135-
< current_block
135+
> current_block
136136
{
137+
// example:
138+
// send on block 10 (last_sent.block_sent = 10)
139+
// KEYGEN_TRANSACTION_RESEND_DELAY_BLOCKS = 2
140+
// resent after Block 12.
141+
// current block is 11: waiting
142+
// current block is 12: waiting
143+
// current block is 13: not entering => YES
144+
137145
// we sent a transaction recently, so we should wait a bit.
138146
return Ok(ShouldSendKeyAnswer::NoWaiting);
139147
}

0 commit comments

Comments
 (0)