btcsuite / btcd

An alternative full node bitcoin implementation written in Go (golang)
https://github.com/btcsuite/btcd/blob/master/README.md
ISC License
6.2k stars 2.35k forks source link

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

Closed robertmin1 closed 3 months ago

robertmin1 commented 5 months ago

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

robertmin1 commented 5 months ago

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.

robertmin1 commented 5 months ago

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 commented 5 months ago

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


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

💛 - Coveralls
robertmin1 commented 4 months ago

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

robertmin1 commented 3 months ago

Any update on this? @guggero