mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-30 19:41:24 +00:00
DeterministicKeyChain: Allow encrypting DeterministicKeyChain with arbitrary path
This commit is contained in:
committed by
Andreas Schildbach
parent
4bbb7be059
commit
e0d9683bd5
@@ -433,6 +433,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
||||
checkNotNull(chain.seed);
|
||||
|
||||
checkArgument(!chain.rootKey.isEncrypted(), "Chain already encrypted");
|
||||
setAccountPath(chain.getAccountPath());
|
||||
|
||||
this.issuedExternalKeys = chain.issuedExternalKeys;
|
||||
this.issuedInternalKeys = chain.issuedInternalKeys;
|
||||
|
@@ -165,6 +165,16 @@ public class WalletTest extends TestWithWallet {
|
||||
basicSpendingCommon(encryptedWallet, myEncryptedAddress, OTHER_ADDRESS, encryptedWallet);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void encryptWalletWithArbitraryPath() throws Exception {
|
||||
final byte[] ENTROPY = Sha256Hash.hash("don't use a string seed like this in real life".getBytes());
|
||||
KeyChainGroup keyChainGroup = new KeyChainGroup(UNITTEST,
|
||||
new DeterministicSeed(ENTROPY, "", 1389353062L),
|
||||
DeterministicKeyChain.BIP44_ACCOUNT_ZERO_PATH);
|
||||
Wallet encryptedWallet = new Wallet(UNITTEST, keyChainGroup);
|
||||
encryptedWallet.encrypt(PASSWORD1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basicSpendingFromP2SH() throws Exception {
|
||||
createMarriedWallet(2, 2);
|
||||
|
Reference in New Issue
Block a user