bug: reschedule rewaking when unpausing pending tx future (#50)

This commit is contained in:
James Prestwich 2020-07-13 10:52:33 -07:00 committed by GitHub
parent 320ab276de
commit 6f02bb5436
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -68,7 +68,8 @@ impl<'a, P: JsonRpcClient> Future for PendingTransaction<'a, P> {
// new block has been mined // new block has been mined
let _ready = futures_util::ready!(this.interval.poll_next_unpin(ctx)); let _ready = futures_util::ready!(this.interval.poll_next_unpin(ctx));
let fut = Box::pin(this.provider.get_transaction_receipt(*this.tx_hash)); let fut = Box::pin(this.provider.get_transaction_receipt(*this.tx_hash));
*this.state = PendingTxState::GettingReceipt(fut) *this.state = PendingTxState::GettingReceipt(fut);
ctx.waker().wake_by_ref();
} }
PendingTxState::GettingReceipt(fut) => { PendingTxState::GettingReceipt(fut) => {
if let Ok(receipt) = futures_util::ready!(fut.as_mut().poll(ctx)) { if let Ok(receipt) = futures_util::ready!(fut.as_mut().poll(ctx)) {
@ -102,7 +103,7 @@ impl<'a, P: JsonRpcClient> Future for PendingTransaction<'a, P> {
// we poll again // we poll again
let fut = Box::pin(this.provider.get_block_number()); let fut = Box::pin(this.provider.get_block_number());
*this.state = PendingTxState::GettingBlockNumber(fut, receipt.clone()); *this.state = PendingTxState::GettingBlockNumber(fut, receipt.clone());
return Poll::Pending; ctx.waker().wake_by_ref();
} }
PendingTxState::GettingBlockNumber(fut, receipt) => { PendingTxState::GettingBlockNumber(fut, receipt) => {
// Wait for the interval // Wait for the interval