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

rpcClient: GetRawChangeAddress is broken with bitcoin core 0.15 #1058

Open
FrozenPrincess opened this issue Sep 19, 2017 · 5 comments
Open

Comments

@FrozenPrincess
Copy link

It previously took in an "account" and no longer does (and gives a hard error if you pass in anything)

@stevenroose
Copy link
Contributor

I think it's weird that the RPC method for btcwallet are now part of btcd inside btcrpcclient. Is being API compatible with Core worth it? I mean maintaining a satoshirpcclient would not be that much work for the people in need of it.

@davecgh
Copy link
Member

davecgh commented Sep 21, 2017

I have been considering dropping support for Core. It constantly changes the RPC API and doesn't have any versioning associated with it. The reason this fails is because they removed the account parameter, which btcwallet needs, so it can't be removed.

You can create a local function in the calling code similar to the following to get around it though:

func getRawChangeAddress(c *rpcclient.Client) (btcutil.Address, error) {
	rawResp, err := c.RawRequest("getrawchangeaddress", nil)
	if err != nil {
		return nil, err
	}
	var addrStr string
	err = json.Unmarshal(rawResp, &addrStr)
	if err != nil {
		return nil, err
	}
	addr, err := btcutil.DecodeAddress(addrStr, chainParams)
	if err != nil {
		return nil, err
	}
	if !addr.IsForNet(chainParams) {
		return nil, fmt.Errorf("address %v is not intended for use on %v",
			addrStr, chainParams.Name)
	}
	return addr, nil
}

@stevenroose
Copy link
Contributor

I'd be in favor of that. In that case, we could move all the wallet methods to btcwalllet/walletrpcclient or similar and it's clear what methods will work on what application.

@jrick
Copy link
Member

jrick commented Sep 21, 2017

The trouble is these methods are used in btcctl, which lives in btcd, and btcctl needs to implement the wallet methods.

@stevenroose
Copy link
Contributor

Hmm. What a mess. walletctl would be aweful, or would it?

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

4 participants