Skip to content

Commit

Permalink
bitcoin core v23 creates descriptor wallets by default, passing false…
Browse files Browse the repository at this point in the history
… parameter for descriptors
  • Loading branch information
LiranCohen committed Jun 18, 2022
1 parent 006e03e commit 8322d03
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
7 changes: 6 additions & 1 deletion lib/bitcoin/BitcoinClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,14 @@ export default class BitcoinClient {
}

private async createWallet () {
// Bitcoin Core 23.0 creates discriptor wallets by default, must set to false until further updates can be made to this repo.
// https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-23.0.md#wallet
const request = {
method: 'createwallet',
params: [this.walletNameToUse] // the wallet name
params: {
wallet_name: this.walletNameToUse,
descriptors: false
}
};

// Intentionally not throwing because bitcoin returns 500 when a wallet is already created
Expand Down
15 changes: 12 additions & 3 deletions tests/bitcoin/BitcoinClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,10 @@ describe('BitcoinClient', async () => {
await bitcoinClient['createWallet']();
expect(rpcSpy).toHaveBeenCalledWith({
method: 'createwallet',
params: ['sidetreeDefaultWallet']
params: {
wallet_name: 'sidetreeDefaultWallet',
descriptors: false
}
}, true, false);
expect(loggerSpy).toHaveBeenCalledWith(`Wallet created with name "sidetreeDefaultWallet".`);
});
Expand All @@ -351,7 +354,10 @@ describe('BitcoinClient', async () => {
} catch {
expect(rpcSpy).toHaveBeenCalledWith({
method: 'createwallet',
params: ['sidetreeDefaultWallet']
params: {
wallet_name: 'sidetreeDefaultWallet',
descriptors: false
}
}, true, false);
}
});
Expand All @@ -362,7 +368,10 @@ describe('BitcoinClient', async () => {
await bitcoinClient['createWallet']();
expect(rpcSpy).toHaveBeenCalledWith({
method: 'createwallet',
params: ['sidetreeDefaultWallet']
params: {
wallet_name: 'sidetreeDefaultWallet',
descriptors: false
}
}, true, false);
expect(loggerSpy).toHaveBeenCalledWith(`Wallet with name sidetreeDefaultWallet already exists.`);
});
Expand Down

0 comments on commit 8322d03

Please sign in to comment.