Skip to content

The use of getinfo before sending a transaction #36

@wmh

Description

@wmh

// 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions