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

refactor(devimint): add get_block_count to bitcoind #3898

Merged

Conversation

bradleystachurski
Copy link
Member

Followup for #3893 (comment)

Copy link

codecov bot commented Dec 9, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (747585f) 56.94% compared to head (022a8a6) 56.99%.

Files Patch % Lines
devimint/src/external.rs 0.00% 3 Missing ⚠️
devimint/src/federation.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3898      +/-   ##
==========================================
+ Coverage   56.94%   56.99%   +0.05%     
==========================================
  Files         193      193              
  Lines       42740    42743       +3     
==========================================
+ Hits        24337    24361      +24     
+ Misses      18403    18382      -21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

/// blocks, where bitcoind's rpc returns the height. Since the genesis
/// block has height 0, we need to add 1 to get the total block count.
pub fn get_block_count(&self) -> Result<u64> {
Ok(self.client().get_block_count()? + 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

We already account for that afaik:

async fn get_block_count(&self) -> anyhow::Result<u64> {
// The RPC function is confusingly named and actually returns the block height
block_in_place(|| self.0.get_block_count())
.map(|height| height + 1)
.map_err(anyhow::Error::from)
}

Maybe something else is wrong?

Copy link
Member Author

Choose a reason for hiding this comment

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

I also found this a bit confusing. The client for Bitcoind in devimint external uses bitcoincore_rpc::Client instead of IBitcoindRpc, so we're essentially duplicating impl.

Should we consider changing the devimint external client to IBitcoindRpc? If so, I can create an issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, on further thought I'm not sure it's a good idea to switch to IBitcoindRpc in devimint external. We rely on accessing several methods from bitcoind's rpc that would make unifying with IBitcoindRpc pretty messy.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, then nevermind.

@elsirion elsirion added this pull request to the merge queue Dec 9, 2023
Merged via the queue into fedimint:master with commit 5ac87ab Dec 9, 2023
20 checks passed
@bradleystachurski bradleystachurski deleted the devimint-get-block-count branch December 9, 2023 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants