/** * Creates a keychain group with no basic chain, and an HD chain that is watching the given watching key. * This HAS to be an account key as returned by {@link DeterministicKeyChain#getWatchingKey()}. */ public KeyChainGroup(NetworkParameters params, DeterministicKey watchKey, boolean useSegwit) { this(params, null, ImmutableList.of(DeterministicKeyChain.watch(watchKey, useSegwit)), null, null, useSegwit); }
/** * Creates a keychain group with no basic chain, and an HD chain that is watching the given watching key. * This HAS to be an account key as returned by {@link DeterministicKeyChain#getWatchingKey()}. */ public KeyChainGroup(NetworkParameters params, DeterministicKey watchKey) { this(params, null, ImmutableList.of(DeterministicKeyChain.watch(watchKey)), null, null); }
/** * Creates a keychain group with no basic chain, and an HD chain that is watching the given watching key. * This HAS to be an account key as returned by {@link DeterministicKeyChain#getWatchingKey()}. */ public KeyChainGroup(NetworkParameters params, DeterministicKey watchKey) { this(params, null, ImmutableList.of(DeterministicKeyChain.watch(watchKey)), null, null); }
/** * Creates a keychain group with no basic chain, and an HD chain that is watching the given watching key. * This HAS to be an account key as returned by {@link DeterministicKeyChain#getWatchingKey()}. */ public KeyChainGroup(NetworkParameters params, DeterministicKey watchKey) { this(params, null, ImmutableList.of(DeterministicKeyChain.watch(watchKey)), null, null); }
@Test(expected = IllegalStateException.class) public void watchingCannotEncrypt() throws Exception { final DeterministicKey accountKey = chain.getKeyByPath(DeterministicKeyChain.ACCOUNT_ZERO_PATH); chain = DeterministicKeyChain.watch(accountKey.dropPrivateBytes().dropParent()); chain = chain.toEncrypted("this doesn't make any sense"); }
@Test public void bloom2() throws Exception { // Verify that if when we watch a key, the filter contains at least 100 keys. DeterministicKey[] keys = new DeterministicKey[100]; for (int i = 0; i < keys.length; i++) keys[i] = chain.getKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); chain = DeterministicKeyChain.watch(chain.getWatchingKey().dropPrivateBytes().dropParent()); int e = chain.numBloomFilterEntries(); BloomFilter filter = chain.getFilter(e, 0.001, 1); for (DeterministicKey key : keys) assertTrue("key " + key, filter.contains(key.getPubKeyHash())); }
watchingKey = DeterministicKey.deserializeB58(null, pub58, params); watchingKey.setCreationTimeSeconds(100000); chain = DeterministicKeyChain.watch(watchingKey); assertEquals(100000, chain.getEarliestKeyCreationTime()); chain.setLookaheadSize(10);