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

feat: load bitcoin network from rpc #224

Merged
merged 1 commit into from Feb 8, 2022

Conversation

gregdhill
Copy link
Member

@gregdhill gregdhill commented Feb 7, 2022

Signed-off-by: Gregory Hill gregorydhill@outlook.com

Adds a builder for the BitcoinCore wrapper to optionally load the Bitcoin network from the getblockchaininfo RPC.

Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
Copy link
Member

@sander2 sander2 left a comment

Choose a reason for hiding this comment

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

I think we should also consider storing the used bitcoin network (i.e. mainnet/testnet/regtest) in the parachain via the chainspec. That way we can provide clearer error messages when inevitably someone connects to the wrong bitcoin node

service/src/lib.rs Show resolved Hide resolved
}

/// Connect to a bitcoin-core full node or timeout.
async fn connect(rpc: &Client, connection_timeout: Duration) -> Result<Network, Error> {
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to make this a private function in BitcoinCoreBuilder? Just to help with organization

Copy link
Member Author

Choose a reason for hiding this comment

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

IMO no because it doesn't require any of the shared fields.

Copy link
Member

Choose a reason for hiding this comment

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

It is possible to put functions in impls that do not take a self argument. But I don't feel super strongly enough about it, so approving..

Copy link
Member Author

Choose a reason for hiding this comment

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

Yah but it's a private function anyway so I don't think it'll add much to the code organization.

@gregdhill gregdhill merged commit dd0d4b4 into interlay:master Feb 8, 2022
@gregdhill gregdhill deleted the feat/load-network branch February 8, 2022 15:02
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