mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-13 02:35:52 +00:00
WalletTest: Add test for roundtripping a wallet via its mnemonic code.
This commit is contained in:
parent
246fc5ae55
commit
883ea24483
@ -3699,4 +3699,16 @@ public class WalletTest extends TestWithWallet {
|
||||
assertNull(wallet.findKeyFromAddress(LegacyAddress.fromKey(UNITTEST, p2wpkhKey)));
|
||||
assertEquals(p2wpkhKey, wallet.findKeyFromAddress(SegwitAddress.fromKey(UNITTEST, p2wpkhKey)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void roundtripViaMnemonicCode() {
|
||||
Wallet wallet = Wallet.createDeterministic(UNITTEST, Script.ScriptType.P2WPKH);
|
||||
List<String> mnemonicCode = wallet.getKeyChainSeed().getMnemonicCode();
|
||||
final DeterministicSeed clonedSeed = new DeterministicSeed(mnemonicCode, null, "",
|
||||
wallet.getEarliestKeyCreationTime());
|
||||
Wallet clone = Wallet.fromSeed(UNITTEST, clonedSeed, Script.ScriptType.P2WPKH);
|
||||
assertEquals(wallet.currentReceiveKey(), clone.currentReceiveKey());
|
||||
assertEquals(wallet.freshReceiveAddress(Script.ScriptType.P2PKH),
|
||||
clone.freshReceiveAddress(Script.ScriptType.P2PKH));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user