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

Enable the RpcClient to send requests to Bitcoin Core over a Unix socket. #2168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robertmin1
Copy link

Enable the RpcClient to send requests to Bitcoin Core over a Unix socket.
Issue #2149

@robertmin1 robertmin1 changed the title Unix Enable the RpcClient able to send requests to Bitcoin Core over a Unix socket. Apr 15, 2024
@robertmin1 robertmin1 changed the title Enable the RpcClient able to send requests to Bitcoin Core over a Unix socket. Enable the RpcClient to send requests to Bitcoin Core over a Unix socket. Apr 15, 2024
Copy link
Contributor

@SulaimanAminuBarkindo SulaimanAminuBarkindo left a comment

Choose a reason for hiding this comment

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

Thanks for this pull request!
Overall, this pull request looks good and seems like a valuable addition to btcd. To further improve its usability and clarity, I have a couple of suggestions:

Example Usage: It would be helpful to add some example usage demonstrations in the examples folder for the rpcclient with this new functionality. This would make it easier for users to understand how to use the new feature in practice.

Testing: To further improve the clarity of the pull request, consider adding some steps to the PR description outlining how to test the newly implemented functionality with Unix sockets. This would be beneficial for both reviewers and future users.

@robertmin1
Copy link
Author

Great! I've included an example that should clarify how to test it further. The only tricky part is that a host needs to be passed to avoid raising errors. The value doesn't matter as long as it's valid. If the client has a default value, this shouldn't be a problem. Perhaps when setting the DialContext, we can hard code a value like localhostunix.

Copy link
Contributor

@SulaimanAminuBarkindo SulaimanAminuBarkindo left a comment

Choose a reason for hiding this comment

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

Thank you for providing the example files.

LGTM

@robertmin1
Copy link
Author

Updated the code. I didn't set a default port when calling ParseAddressString since the host doesn't seem to have one.
Additionally, I used ParseAddressString to set a placeholder for Unix sockets in handleSendPostMessage in a cleaner way

@coveralls
Copy link

coveralls commented Apr 25, 2024

Pull Request Test Coverage Report for Build 8907194933

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 28 of 70 (40.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.007%) to 56.865%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rpcclient/infrastructure.go 28 70 40.0%
Totals Coverage Status
Change from base Build 8881487645: -0.007%
Covered Lines: 29482
Relevant Lines: 51846

💛 - Coveralls

Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Thanks for the updates. Looks better now, but still got a couple of asks.

rpcclient/examples/bitcoincoreunixsocket/README.md Outdated Show resolved Hide resolved
rpcclient/examples/bitcoincoreunixsocket/main.go Outdated Show resolved Hide resolved
rpcclient/examples/bitcoincoreunixsocket/main.go Outdated Show resolved Hide resolved
rpcclient/infrastructure.go Outdated Show resolved Hide resolved
rpcclient/infrastructure.go Outdated Show resolved Hide resolved
rpcclient/infrastructure.go Outdated Show resolved Hide resolved
Sending RPC requests through unix sockets
@robertmin1
Copy link
Author

Great! Thank you for reviewing. I've implemented the suggested changes.

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

4 participants