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

The use of getinfo before sending a transaction #36

Open
wmh opened this issue Jul 8, 2024 · 0 comments
Open

The use of getinfo before sending a transaction #36

wmh opened this issue Jul 8, 2024 · 0 comments

Comments

@wmh
Copy link

wmh commented Jul 8, 2024

// litecoind nodes as of v0.16.0, so we'll assume the client is connected
// to a ltcd backend if it does exist.
info, err := c.GetInfo()
switch err := err.(type) {
// Parse the ltcd version and cache it.
case nil:
log.Debugf("Detected ltcd version: %v", info.Version)
version := Btcd
c.backendVersion = &version
return *c.backendVersion, nil
// Inspect the RPC error to ensure the method was not found, otherwise
// we actually ran into an error.
case *btcjson.RPCError:
if err.Code != btcjson.ErrRPCMethodNotFound.Code {
return 0, fmt.Errorf("unable to detect ltcd version: "+
"%v", err)
}
default:
return 0, fmt.Errorf("unable to detect ltcd version: %v", err)

Some node providers, such as getblock.io, return a 403 Forbidden for the getinfo API. As a result, it is unable to send transactions due to the inability to use the getinfo API. Is it better to skip the error on this API call?

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

No branches or pull requests

1 participant