mirror of
https://github.com/status-im/nim-ethers.git
synced 2025-02-16 09:08:39 +00:00
Ensure that confirm
future is only finished once
Should fix CI failure https://github.com/status-im/nim-ethers/runs/6557104597
This commit is contained in:
parent
649dc8efd0
commit
fff0d189a5
@ -261,15 +261,17 @@ method confirm*(tx: TransactionResponse,
|
||||
if receipt.hasBeenMined(blkNum, wantedConfirms):
|
||||
# fire and forget
|
||||
discard subscription.unsubscribe()
|
||||
if not retFut.finished:
|
||||
retFut.complete(receipt.get)
|
||||
|
||||
elif timeoutInBlocks > 0:
|
||||
let blocksPassed = (blkNum - startBlock) + 1
|
||||
if blocksPassed >= timeoutInBlocks.u256:
|
||||
discard subscription.unsubscribe()
|
||||
retFut.fail(
|
||||
newException(JsonRpcProviderError, "Transaction was not mined in " &
|
||||
$timeoutInBlocks & " blocks"))
|
||||
if not retFut.finished:
|
||||
let message =
|
||||
"Transaction was not mined in " & $timeoutInBlocks & " blocks"
|
||||
retFut.fail(newException(JsonRpcProviderError, message))
|
||||
|
||||
# If our tx is already mined, return the receipt. Otherwise, check each
|
||||
# new block to see if the tx has been mined
|
||||
|
Loading…
x
Reference in New Issue
Block a user