-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Return null number for pending block in eth_getBlockByNumber #8281
Return null number for pending block in eth_getBlockByNumber #8281
Conversation
It looks like @sorpaas signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
@@ -230,7 +230,10 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> EthClient<C, SN, S | |||
state_root: view.state_root().into(), | |||
transactions_root: view.transactions_root().into(), | |||
receipts_root: view.receipts_root().into(), | |||
number: Some(view.number().into()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the same spec hash
should be null as well.
rpc/src/v1/impls/eth.rs
Outdated
@@ -180,9 +180,9 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> EthClient<C, SN, S | |||
fn rich_block(&self, id: BlockNumberOrId, include_txs: bool) -> Result<Option<RichBlock>> { | |||
let client = &self.client; | |||
|
|||
let client_query = |id| (client.block(id), client.block_total_difficulty(id), client.block_extra_info(id)); | |||
let client_query = |id, is_pending| (client.block(id), client.block_total_difficulty(id), client.block_extra_info(id), is_pending); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just inline false
here, no point to pass is_pending
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops right.
According to the spec, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #490 Compatibility with openethereum/parity-ethereum#8281, which fixed openethereum/parity-ethereum#8028 and made pending return be compliant with Ethereum docs.
Fixes #490 Compatibility with openethereum/parity-ethereum#8281, which fixed openethereum/parity-ethereum#8028 and made pending return be compliant with Ethereum docs.
Fixes #490 Compatibility with openethereum/parity-ethereum#8281, which fixed openethereum/parity-ethereum#8028 and made pending return be compliant with Ethereum docs.
Fixes #490 Compatibility with openethereum/parity-ethereum#8281, which fixed openethereum/parity-ethereum#8028 and made pending return be compliant with Ethereum docs.
Fixes #8028
Check whether it's fetching the pending block. If so, write the block number as null in JSONRPC.