use of org.bitcoinj.wallet.KeyChainGroupStructure in project haveno by haveno-dex.
the class HavenoKeyChainFactory method makeKeyChain.
@Override
public DeterministicKeyChain makeKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicSeed seed, KeyCrypter crypter, boolean isMarried, Script.ScriptType outputScriptType, ImmutableList<ChildNumber> accountPath) {
ImmutableList<ChildNumber> maybeUpdatedAccountPath = accountPath;
if (DeterministicKeyChain.ACCOUNT_ZERO_PATH.equals(accountPath)) {
// This is a bitcoinj 0.14 wallet that has no account path in the serialized mnemonic
KeyChainGroupStructure structure = new HavenoKeyChainGroupStructure();
maybeUpdatedAccountPath = structure.accountPathFor(outputScriptType);
}
return super.makeKeyChain(key, firstSubKey, seed, crypter, isMarried, outputScriptType, maybeUpdatedAccountPath);
}
use of org.bitcoinj.wallet.KeyChainGroupStructure in project haveno by haveno-dex.
the class WalletConfig method createWallet.
protected Wallet createWallet() {
Script.ScriptType preferredOutputScriptType = Script.ScriptType.P2WPKH;
KeyChainGroupStructure structure = new HavenoKeyChainGroupStructure();
KeyChainGroup.Builder kcgBuilder = KeyChainGroup.builder(params, structure);
if (restoreFromSeed != null) {
kcgBuilder.fromSeed(restoreFromSeed, preferredOutputScriptType);
} else {
// new wallet
// btc wallet uses a new random seed.
kcgBuilder.fromRandom(preferredOutputScriptType);
}
return new Wallet(params, kcgBuilder.build());
}
Aggregations