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

Commit 4e05f82

Browse files
Merge pull request #1044 from lightninglabs/poll-new-address
Poll new address
2 parents d2043dd + b7b8b37 commit 4e05f82

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

src/action/index-mobile.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ when(() => store.walletUnlocked, () => grpc.initLnd());
9999
when(
100100
() => store.lndReady,
101101
() => {
102-
wallet.getNewAddress();
103102
wallet.pollBalances();
104103
wallet.pollExchangeRate();
105104
channel.pollChannels();

src/action/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ when(
9292
() => store.lndReady && store.autopilotReady,
9393
() => {
9494
autopilot.init();
95-
wallet.getNewAddress();
9695
wallet.pollBalances();
9796
wallet.pollExchangeRate();
9897
channel.pollChannels();

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)