Skip to content

Commit

Permalink
[WIP] Add native segwit keychain to wallets that don't have one
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarguindzberg committed May 22, 2020
1 parent e7aeb5b commit bfd545f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/src/main/java/bisq/core/btc/setup/WalletConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,16 @@ private Wallet loadWallet(boolean shouldReplayWallet, File walletFile, boolean i
wallet = serializer.readWallet(params, extArray, proto);
if (shouldReplayWallet)
wallet.reset();
if (!isBsqWallet && BisqKeyChainGroupStructure.BIP44_BTC_NON_SEGWIT_ACCOUNT_PATH.equals(wallet.getActiveKeyChain().getAccountPath())) {
// Btc wallet does not have a native segwit keychain, we should add one.
DeterministicSeed seed = wallet.getKeyChainSeed();
DeterministicKeyChain nativeSegwitKeyChain = DeterministicKeyChain.builder().seed(seed)
.outputScriptType(Script.ScriptType.P2WPKH)
.accountPath(new BisqKeyChainGroupStructure(isBsqWallet).accountPathFor(Script.ScriptType.P2WPKH)).build();
wallet.addAndActivateHDChain(nativeSegwitKeyChain);
}


} finally {
walletStream.close();
}
Expand Down

0 comments on commit bfd545f

Please sign in to comment.