Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve parity nodes invalid "eth_getBlockByNumber" JSONRPC call #2847

Merged
merged 11 commits into from
May 31, 2019
12 changes: 10 additions & 2 deletions packages/web3-core-method/src/observers/TransactionObserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/**
* @file TransactionObserver.js
* @author Samuel Furter <samuel@ethereum.org>
* @author Josh Stevens <joshstevens19@hotmail.co.uk>
* @date 2019
*/

Expand Down Expand Up @@ -158,8 +159,15 @@ export default class TransactionObserver {
this.emitNext(receipt, observer);
}
} else {
this.lastBlock = await this.getBlockByNumber(receipt.blockNumber);
this.confirmations++;
// on parity nodes you can get the receipt without it being mined
// so the receipt may not have a block number at this point.
// we should check that the blockNumber is defined before we do this call
// geth nodes only return the receipt once mined as the spec states.
if (receipt.blockNumber) {
joshstevens19 marked this conversation as resolved.
Show resolved Hide resolved
this.lastBlock = await this.getBlockByNumber(receipt.blockNumber);
this.confirmations++;
}

this.emitNext(receipt, observer);
}

Expand Down