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
Conversation
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
cd75080
to
a4e5fca
Compare
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.
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
} | ||
|
||
/// Connect to a bitcoin-core full node or timeout. | ||
async fn connect(rpc: &Client, connection_timeout: Duration) -> Result<Network, Error> { |
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.
Would it make sense to make this a private function in BitcoinCoreBuilder
? Just to help with organization
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.
IMO no because it doesn't require any of the shared fields.
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.
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..
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.
Yah but it's a private function anyway so I don't think it'll add much to the code organization.
Signed-off-by: Gregory Hill gregorydhill@outlook.com
Adds a builder for the
BitcoinCore
wrapper to optionally load the Bitcoin network from thegetblockchaininfo
RPC.