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

getWachingKey contains private Key, and result in err while clone the wallet #80

Open
superiums opened this issue Nov 13, 2018 · 1 comment

Comments

@superiums
Copy link

superiums commented Nov 13, 2018

`

	NetworkParameters params = MainNetParams.get();
	Wallet toWatch=new Wallet(params);
	System.out.println(toWatch.toString());
	DeterministicKey watchingKey = toWatch.getWatchingKey();
	System.out.format("key priv: %s\n", watchingKey.getPrivateKeyAsHex());

	watchingKey.dropPrivateBytes().dropParent();

	System.out.format("after drop.\nkey data: %s\n", watchingKey.toString());
	System.out.format("key priv: %s\n", watchingKey.getPrivateKeyAsHex());
	
	Wallet watchingWallet = Wallet.fromWatchingKey(params, watchingKey);

`

Exception in thread "main" java.lang.IllegalArgumentException: Private subtrees not currently supported: if you got this key from DKC.getWatchingKey() then use .dropPrivate().dropParent() on it first. at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122) at org.bitcoinj.wallet.DeterministicKeyChain.<init>(DeterministicKeyChain.java:318) at org.bitcoinj.wallet.DeterministicKeyChain.watch(DeterministicKeyChain.java:351) at org.bitcoinj.wallet.KeyChainGroup.<init>(KeyChainGroup.java:92) at org.bitcoinj.wallet.Wallet.fromWatchingKey(Wallet.java:279) at shen.Test.main(Test.java:32)

@superiums
Copy link
Author

superiums commented Nov 13, 2018

getPrivateKeyAsHex() always returns a privateKey. i think the watchingkey should not contain privatekey,right?
and .dropPrivateBytes().dropParent() not work.

I'm using the source for BCH , cloned by git.

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