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

Unable to get new address rpcclient.GetNewAddress() for simnet due to hardcoded mainnet params #1519

Closed
nostdm opened this issue Jan 16, 2020 · 3 comments

Comments

@nostdm
Copy link

nostdm commented Jan 16, 2020

Some wallet methods in the rpcclient library have hardcoded the chaincfg.MainNetParams for example the GetNewAddress() method calls the Receive() method which hardcodes the MainNetParams when decoding the address:

func (r FutureGetNewAddressResult) Receive() (btcutil.Address, error) {
	res, err := receiveFuture(r)
	if err != nil {
		return nil, err
	}

	// Unmarshal result as a string.
	var addr string
	err = json.Unmarshal(res, &addr)
	if err != nil {
		return nil, err
	}

	return btcutil.DecodeAddress(addr, &chaincfg.MainNetParams)
}

This returns an error when talking to btcwallet/btcd in --simnet mode.

Is there a way to tell the rpcclient to use SimnetParams when talking to a simnet server?

Potential way to fix this would be to allow the user to specify the network type when constructing the client:

	client, err := rpcclient.New(&rpcclient.ConnConfig{
		Host: ...,
		Endpoint: ...,
		User: ...,
		Pass: ...,
		Certificates: ...,
                Network: "Simnet",
	}, &notificationHandlers)
@torkelrogstad
Copy link
Contributor

Duplicate of #1466

@nostdm
Copy link
Author

nostdm commented Jan 17, 2020

It seems that this PR fixes the issue #1467 Is there any reason it hasn't been merged yet?

@jakesylvestre
Copy link
Collaborator

Fixed by #1467

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

3 participants