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

Unknown address type #1406

Closed
domgolonka opened this issue Mar 19, 2019 · 6 comments
Closed

Unknown address type #1406

domgolonka opened this issue Mar 19, 2019 · 6 comments

Comments

@domgolonka
Copy link

I am trying to connect using the RPCCLIENT on a testnet. Whenever I call GetNewAddress or GetAccountAddress

address, err := this.client.GetAccountAddress("default")
	if (err != nil) {
		logs.Error(err)
		return false
	}

It always shows the err "unknown address type" even though the account exists:

#btcctl --rpcuser=xxx --rpcpass=xxx --wallet --testnet --rpcserver=localhost:8332 listaccounts
{
  "default": 0,
  "main": 0,
  "imported": 0
}
#btcctl --rpcuser=xxx --rpcpass=xxx --wallet  --rpcserver=localhost:8332 getaccountaddress default
mumXAA57R7AeSg2UkZroAHu3SfAUWgnjzA
@domgolonka
Copy link
Author

Found the bug. It calls btcutil.DecodeAddress(addrStr, &chaincfg.MainNetParams) instead of &chaincfg.TestNet3Params

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

	// Unmashal result as an array of string.
	var addrStrings []string
	err = json.Unmarshal(res, &addrStrings)
	if err != nil {
		return nil, err
	}

	addrs := make([]btcutil.Address, 0, len(addrStrings))
	for _, addrStr := range addrStrings {
		addr, err := btcutil.DecodeAddress(addrStr,
			&chaincfg.MainNetParams)
		if err != nil {
			return nil, err
		}
		addrs = append(addrs, addr)
	}

	return addrs, nil
}

@kobayashi5884
Copy link

I have the same issue. This issue seems not to be fixed yet. Is there any workaround now?

@rusticbison
Copy link

I also just experienced this issue. Would be good to see this re-opened.

@JFixby
Copy link

JFixby commented Sep 7, 2019

#1466

@Rjected
Copy link
Contributor

Rjected commented Jun 18, 2020

Fixed by #1467

@jakesylvestre
Copy link
Collaborator

Closing as per #1467. Feel free to reopen if this is still an issue @domgolonka

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

6 participants