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 8772206116

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

  • 3 of 19 (15.79%) changed or added relevant lines in 1 file are covered.
  • 243 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.01%) to 56.873%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rpcclient/infrastructure.go 3 19 15.79%
Files with Coverage Reduction New Missed Lines %
chaincfg/params.go 4 97.35%
peer/peer.go 6 74.16%
rpcclient/infrastructure.go 233 39.21%
Totals Coverage Status
Change from base Build 8802845904: -0.01%
Covered Lines: 29452
Relevant Lines: 51786

💛 - Coveralls

Sending RPC requests through unix sockets
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