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

add uncle related missing api #385

Merged
merged 1 commit into from
Aug 19, 2021
Merged

add uncle related missing api #385

merged 1 commit into from
Aug 19, 2021

Conversation

alexlee85
Copy link
Contributor

Motivation

missing uncle block related api

Solution

add uncle block related missing api

})
}

async fn get_uncle_gen(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async fn get_uncle_gen(
async fn get_uncle(

The _gen suffix was added to the get_block_gen function, so that you can choose between getting just the transaction hashes or the full transaction set due to the boolean parameter supplied to it. In this case it shouldn't be necessary since uncle blocks are always w/o transactions.

@@ -164,6 +164,40 @@ impl<P: JsonRpcClient> Provider<P> {
}
})
}

async fn get_uncle_count_gen(&self, id: BlockId) -> Result<U256, ProviderError> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async fn get_uncle_count_gen(&self, id: BlockId) -> Result<U256, ProviderError> {
async fn get_uncle_count(&self, id: BlockId) -> Result<U256, ProviderError> {

Same comment as below

&self,
block_hash_or_number: T,
) -> Result<U256, Self::Error> {
self.get_uncle_count_gen(block_hash_or_number.into()).await
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.get_uncle_count_gen(block_hash_or_number.into()).await
self.get_uncle_count(block_hash_or_number.into()).await

block_hash_or_number: T,
idx: U256,
) -> Result<Option<Block<H256>>, ProviderError> {
self.get_uncle_gen(block_hash_or_number.into(), idx).await
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.get_uncle_gen(block_hash_or_number.into(), idx).await
self.get_uncle(block_hash_or_number.into(), idx).await

Copy link
Owner

@gakonst gakonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thank you.

@gakonst gakonst merged commit f6412f8 into gakonst:master Aug 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants