Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
fix(pending_tx): fix off by one error
Browse files Browse the repository at this point in the history
  • Loading branch information
gakonst committed Dec 24, 2020
1 parent 56bdb84 commit 6944702
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ethers-providers/src/pending_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,12 @@ impl<'a, P: JsonRpcClient> Future for PendingTransaction<'a, P> {

// if the transaction has at least K confirmations, return the receipt
// (subtract 1 since the tx already has 1 conf when it's mined)
if current_block >= inclusion_block + *this.confirmations - 1 {
if current_block > inclusion_block + *this.confirmations - 1 {
let receipt = *receipt.clone();
*this.state = PendingTxState::Completed;
return Poll::Ready(Ok(receipt));
} else {
tracing::trace!(tx_hash = ?this.tx_hash, "confirmations {}/{}", current_block - inclusion_block + 1, this.confirmations);
*this.state = PendingTxState::PausedGettingBlockNumber(receipt.clone());
ctx.waker().wake_by_ref();
}
Expand Down

0 comments on commit 6944702

Please sign in to comment.