Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 5746fea

Browse files
committed
Poll NewAddress grpc api
1 parent d2043dd commit 5746fea

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/action/wallet.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ class WalletAction {
144144
* @return {Promise<undefined>}
145145
*/
146146
async update() {
147-
await Promise.all([this.getBalance(), this.getChannelBalance()]);
147+
await Promise.all([
148+
this.getBalance(),
149+
this.getChannelBalance(),
150+
this.getNewAddress(),
151+
]);
148152
}
149153

150154
/**
@@ -472,12 +476,9 @@ class WalletAction {
472476
* @return {Promise<undefined>}
473477
*/
474478
async getNewAddress() {
475-
// - `p2wkh`: Pay to witness key hash (`WITNESS_PUBKEY_HASH` = 0)
476-
// - `np2wkh`: Pay to nested witness key hash (`NESTED_PUBKEY_HASH` = 1)
477-
// - `p2pkh`: Pay to public key hash (`PUBKEY_HASH` = 2)
478479
try {
479480
const { address } = await this._grpc.sendCommand('NewAddress', {
480-
type: 1,
481+
type: 3, // UNUSED_NESTED_PUBKEY_HASH = 3
481482
});
482483
this._store.walletAddress = address;
483484
} catch (err) {

test/unit/action/wallet.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ describe('Action Wallet Unit Tests', () => {
138138
it('should refresh wallet balances', async () => {
139139
sandbox.stub(wallet, 'pollExchangeRate');
140140
await wallet.update();
141-
expect(grpc.sendCommand, 'was called twice');
141+
expect(grpc.sendCommand, 'was called thrice');
142142
expect(wallet.pollExchangeRate, 'was not called');
143143
});
144144
});

0 commit comments

Comments
 (0)